TroySteven
TroySteven

Reputation: 5157

Custom 404 Error Messages ASP.NET Visual Studio

Anyone know how to set the custom 404 Error pages that the Visual Studio Development Server uses?

I know how to get it to work if I set is as a local IIS server and then setup the custom 404 pages in IIS. But I want to actually change them on the local VS development server so that when I test the application in Visual studio's Development server, it just works.

I'm assuming its a setting in VS.

I'm currently running VS 2010.

I've already added the custom 404 redirect for .aspx pages in the web.config. Now I need to figure out to change the error redirect for all other pages.

Upvotes: 3

Views: 4288

Answers (2)

skub
skub

Reputation: 2306

Not sure if this is what you are after, but you can set it up in your web.config as follows:

<customErrors defaultRedirect="GenericError.htm" mode="On">
          <error statusCode="404" redirect="notfound.htm"/>
      </customErrors>

and have a html file called notfound.html

References:

Upvotes: 3

McGarnagle
McGarnagle

Reputation: 102753

The easiest way is probably to just set up an application on your local IIS, or use that "IIS Express" option that vs 2010 provides: http://learn.iis.net/page.aspx/868/iis-express-overview/

You could also use a "mock config" approach, but this strikes me as too much work. Testing Methods with Reference to Web.Config in .Net C#

Upvotes: 1

Related Questions