I have an MVC application in .NET 3.5 framework which is hosted in IIS 7. I have created the application in the root of the IIS 7. My application works fine when i try to access the by the path "http://localhost". But if i try to access any file present under the "Views" folder i get the follwoing error.
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.
I have tried all ways and means to fix this bug but in vain. Would be grateful if anybdy can help me to identify the probelm.
Thanks
Best Answer
In ASP.NET MVC you don't browse to your view files directly. You have to use the routes that are setup in your site's Application_Start() event.
For example, a new ASP.NET MVC project adds this route by default in global.asax:
It also adds a default controller and action:
And a View under Views/Home named Index.aspx.
Instead of using the address
http://mysite.com/Views/Home/Index.aspx
you would usehttp://mysite.com/Home/Index
You can learn more about routing here: http://www.asp.net/learn/mvc/#MVC_Routing