Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET MVC Page Won't Load and says "The resource cannot be found"

I am having a problem where I try to open my ASP.NET MVC application but I get the ASP.NET error page which says this:

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: /EventScheduler/account.aspx/login

Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053**

I am using the URL trick from this blog post and that is why I have the .aspx in the URL:

http://blog.codeville.net/2008/07/04/options-for-deploying-aspnet-mvc-to-iis-6/

It works on my other sandbox server (not a dev machine), and now I just deployed it to my production site as a new virtual directory, but for some reason it seems like it's actually looking for a .aspx file.

Any ideas? I think I must be forgetting a step.

like image 497
skb Avatar asked May 21 '09 15:05

skb


People also ask

How do I fix resource Cannot be found?

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.

What is HTML ActionLink in MVC?

Html. ActionLink creates a hyperlink on a view page and the user clicks it to navigate to a new URL. It does not link to a view directly, rather it links to a controller's action.


2 Answers

I got the same error when building. The default is to use URLRoute settings for navigating. If you select the "Set as Startup Page" property by right clicking any cshtml page, that throws this error because there are always a routing to the current page under the Global.asax file.

Look at Project Properties for Startup Path and delete it.

like image 162
dewelloper Avatar answered Sep 28 '22 02:09

dewelloper


I found the solution for this problem, you don't have to delete the global.asax, as it contains some valuable info for your proyect to run smoothly, instead have a look at your controller's name, in my case, my controller was named something as MyController.cs and in the global.asax it's trying to reference a Home Controller.

Look for this lines in the global asax

routes.MapRoute(    "Default", // Route name    "{controller}/{action}/{id}", // URL with parameters    new { controller = "Home", action = "Index", id = UrlParameter.Optional }  

in my case i had to get like this to work

    new { controller = "My", action = "Index", id = UrlParameter.Optional } 
like image 31
AleckxGhost Avatar answered Sep 28 '22 04:09

AleckxGhost