
March 11th, 2005, 11:41 AM
|
|
Registered User
|
|
Join Date: Aug 2004
Posts: 3
Time spent in forums: 27 m 8 sec
Reputation Power: 0
|
|
|
Handling Custom Error 401.2 (Re-visited)
---This is a continuation of a previous thread that's gotten a little stale. ---
Hi Elguaro,
In my original post (http://forums.aspfree.com/showpost.php?p=100206&postcount=5) I gave a technique for overriding the default 401.2 error (one of the few that ASP.NET doesn't allow us to customize via web.config). You asked:
Quote: | Originally Posted by elguaro This does display the custom error page but I'm also getting a pop-window with an "Enter Network Password" dialog. How can I get rid of this and go straight to my custom error page????? Thanks |
You are getting the network password dialog because your error page is using the same security settings that the rest of your application is and, if you're not allowing this person access to the rest of your site, you're not allowing them access to your error page either.
I should have mentioned that in my original post (sorry, but I was a little out of it by then). To override your security settings and allow anyone to view your error page(s) I recommend the following: - Create a folder called "errors" underneath your application's root folder.
- Add the following to your web.config file inside the <configuration> tags
<location path="errors" allowOverride="true">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location> - Be careful that you don't create any security issues by exposing the pages in this folder (i.e. error pages that might display information that a hacker or malicious user might find useful. If you want to be extra cautious, you can modify the <location> tag above so that it only overrides the security settings for your single error page.
That should do it!
Cheers,
John
|