I am running into this error while using Url.Action is ASP.net MVC 5
Server Error in '/' Application. The resource cannot be found. Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly. Requested URL: /Home/AddPhoto
Here is the relevant portion of the view. The following url.action call is the one that fails : @Url.Action("AddPhoto", "Home")
</div>
@using (Html.BeginForm("Index", "Home", FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
{
<div class="col-md-8">
<textarea class="search-query span2 text-center" rows="13" style="width: 2200px; height: 50px;" id="searchText" name="searchText" placeholder="What is on your mind?" type="text" value="What is on your mind? "></textarea>
<br />
<a href="#" id="addphoto" onclick="window.location.href='@Url.Action("AddPhoto", "Home")'">
<span rel="tooltip" title="Add photo"><i class="fa fa-camera"></i></span>
</a>
<br />
<input type="reset" value="Cancel" name="Command" style="text-align:right" /> <input type="submit" name="Command" value="Post" style="text-align:right" />
<br />
<br />
In my HomeController.cs file, I do have this method:
public ActionResult AddPhoto()
{
return View();
}
And the actual view file , does exist under Views/Home
Screen grab of views/home directory
I am hence not understanding the reason why I am hitting the 404 not found error. Can someone please help me out over here?