Displaying Another View in ASP.Net Web API Client
<p>New to the world of Web API and I can't seem to get any custom view to display. I've done the basics, made a method in my controller that seems to be linked corrected where I'm calling it. I'm more familiar with MVC so I'm wondering am I missing something basic here? The view always returns an error can't be accessed for me.</p>
<p>The ActionResult, in the generated HomeController:</p>
<pre><code>[HttpGet]
public ActionResult SpotDetails()
{
    ViewBag.Title = &quot;Spot Details&quot;;
    return View();
}
</code></pre>
<p>The link to call it in the menu:</p>
<pre><code>&lt;ul class=&quot;nav navbar-nav&quot;&gt;
    &lt;li&gt;@Html.ActionLink(&quot;SHOR //&quot;, &quot;Index&quot;, &quot;Home&quot;, new {area = &quot;&quot;}, null)&lt;/li&gt;
    &lt;li&gt;@Html.ActionLink(&quot;Index&quot;, &quot;Index&quot;, &quot;Home&quot;, new {area = &quot;&quot;}, null)&lt;/li&gt;
    &lt;li&gt;@Html.ActionLink(&quot;Spot Profile&quot;, &quot;SpotDetails&quot;, &quot;Home&quot;, new {area = &quot;&quot;}, null)&lt;/li&gt;
    &lt;li&gt;@Html.ActionLink(&quot;API&quot;, &quot;Index&quot;, &quot;Help&quot;, new {area = &quot;&quot;}, null)&lt;/li&gt;
&lt;/ul&gt;
</code></pre>
<p>I should say the links to the index and the api help pages work perfectly.</p>
<p>This is my RouteConfig in case it's at fault, I haven't touched it at all:</p>
<pre><code>public static void RegisterRoutes(RouteCollection routes)
{
    routes.IgnoreRoute(&quot;{resource}.axd/{*pathInfo}&quot;);

    routes.MapRoute(
        name: &quot;Default&quot;,
        url: &quot;{controller}/{action}/{id}&quot;,
        defaults: new { controller = &quot;Home&quot;, action = &quot;Index&quot;, id = UrlParameter.Optional }
    );
}
</code></pre>
<p>And finally my WebApiConfig:</p>
<pre><code>public static void Register(HttpConfiguration config)
{
    // Web API configuration and services
    config.Formatters.Remove(config.Formatters.XmlFormatter);
    config.Formatters.JsonFormatter.SerializerSettings.ReferenceLoopHandling =
        Newtonsoft.Json.ReferenceLoopHandling.Ignore;

    // Web API routes
    config.MapHttpAttributeRoutes();

    config.Routes.MapHttpRoute(
        name: &quot;DefaultApi&quot;,
        routeTemplate: &quot;api/{controller}/{id}&quot;,
        defaults: new { id = RouteParameter.Optional }
    );
}
</code></pre>
<p>Edit - the error message when the link is clicked:</p>
<blockquote>
<p>Server Error in '/' Application.</p>
<p>The resource cannot be found.</p>
<p>Description: HTTP 404. The resource you are looking for (or one of its &gt;dependencies) could have been removed, had its name changed, or is temporarily &gt;unavailable.  Please review the following URL and make sure that it is spelled &gt;correctly.</p>
<p>Requested URL: /Home/SpotDetails</p>
</blockquote>