Customize 404 server error in .Net

S

SMG

Hi All,

From where I can customize 404 error.

I.e. the error is printed below..

Server Error in '/sharekhan' 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: /Sharekhan/asdf.aspx





Version Information: Microsoft .NET Framework Version:



Regards,
Shailesh G
 
G

Grant Merwitz

this is done through IIS

if you open IIS and go to your defatul website.
Right click and select properties.
Click on the Tab 'Custom Errors'

And from there you can change these errors.

If you are using a virtual directory, this will have to be done on the
virtual directory
 
S

SMG

Other than that...
through the config file can I do so?
this is done through IIS

if you open IIS and go to your defatul website.
Right click and select properties.
Click on the Tab 'Custom Errors'

And from there you can change these errors.

If you are using a virtual directory, this will have to be done on the
virtual directory
 
G

Grant Merwitz

Yes, by adding the following in the <system.web> node

<customErrors mode="RemoteOnly" defaultRedirect="/ErrorPage.aspx" >

<error statusCode="404" redirect="/pagenotfound.aspx" />

</customErrors>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top