Saturday, December 5, 2009

How to fix invisible view in ASP.net mvc

This is not the most significant I know, but the goal is to document every problem that took more than 15 minutes to solve, and I did try the more complicated methods before I tried the obvious one, so here it is.

The Problem: When programming in ASP.net MVC in Visual Studio 2008 you create a new folder, in the views directory, then create a new view in that directory called Index. For example I was working on the Stronico public site (coming soon, really) and created a directory called "Contact", and a view called "Index.aspx" so the url could be http://www.Stronico.com/Contact/. I also created the Controller "ContactController.cs". When I went to the staging site on LocalHost, I got the "File Not Found" error.

The Cause: I never did find out. I tried changing the verbiage slightly, in case contact was a protected word, I reset IIS, I did several other things. None of the usual methods worked.

The Solution: I finally just closed the solution and restarted it and I was able to get to the contact page. No idea why that worked, but it did.

Sort of a a lame post, but I did spend slightly more than fifteen minutes trying to see why the page would not appear, only to find it to be a simple Visual Studio error.

Labels: ,

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]



<< Home