PDA

View Full Version : 404 Setting for a sub-application


bebemau
11-06-2003, 11:52 AM
Hi all,

I have set one of my subfolders as an application, so I have 2 applications under my account. I know I can use IIS manager in control panel to set the default redirect page for any 404 error. But that setting is for my root application only. So is there a way to set a 404 error default redirect for my sub-application(except in web.config)?

Thanks in advance.

KPayne
11-07-2003, 07:35 AM
You cannot configure a different CustomError page from your root web.config on DASP. However, you can get the same result by adding code to the Application_Error event in the global.asax.vb file of your sub web:

Sub Application_Error(ByVal sender as Object, ByVal e as EventArgs)

Response.Redirect("myErrorPage.aspx")

End Sub

Keith Payne
Technical Marketing Solutions

bebemau
11-08-2003, 01:00 AM
KPayne,

Although web.config is not what I wanted to use to handle 404 errors, I gave it a try anyway, and it seems to be working properly.

I assume what you are talking about is when you have an aspx application at the root with its own web.config, and at the same time you have another aspx sub-application in which has its own web.config also.

My config is a little different, I have an asp application at the root, and I have an aspx application as the sub-web.

But thats good info to know. Thanks!!

bebemau
11-08-2003, 09:42 AM
Hi there,

Thanks for the reply. You meant if I put this code in my webconfig under my subweb, it will not work?

<customErrors mode="On">
<error statusCode="404" redirect="404.aspx"/>
</customErrors>

KPayne
11-08-2003, 12:11 PM
Correct. The <system.web> section of the web.config - where the <customErrors> tag goes - will give an error if you have it in a subweb.

Keith Payne
Technical Marketing Solutions