|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi all, Our web application is Integrated windows authenticated.
If an unauthenticated user tries to access the web site, We get 401.2 error. I want to handle this error and redirect them to the Custom error page. For this I tried to use 1. Custom errors option in IIS 2. <CustomErrors> element in web.config. (This works fine for other errors such as 404, 403 but not 401) 3. I even tried to give full access to the custom page with <Location> <allow> elements in web.config. Even that didnt work. Do you have any soultion for this? |
|
#2
|
|||
|
|||
|
What version of Windows and IIS are you using?
|
|
#3
|
|||
|
|||
|
Handling Custom Error 401.2
Windows XP Professional & IIS 5.1.
|
|
#4
|
||||
|
||||
|
Can't be done 401.2 Custom Errors in ASP.NET
From http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/ASPNet-JSPMig-Authentication.asp
Quote:
Quote:
|
|
#5
|
|||
|
|||
|
Hi Sirishacrr,
You can replace the default 401.2 message that ASP.NET displays, although it isn't exactly an intuitive process. I spent a week or so trawling for solutions with no luck, but it turns out that the solution is remarkably simple. Add the following to your Global.asax file and replace the "~/errors/Unauthorized.aspx" with the path to your own .aspx error page: PrivateSub Global_EndRequest(ByVal sender AsObject, ByVal e As System.EventArgs) HandlesMyBase.EndRequest If Response.StatusCode = 401 AndAlso Request.IsAuthenticated = TrueThen Response.ClearContent() Server.Execute("~/errors/Unauthorized.aspx") EndIf EndSub This method will still allow the user the opportunity to provide alternate credentials, but will replace the default 401.2 message from ASP.NET with the text of the aspx page that you specify. If you want to load static content instead, you can use the Response.WriteFile() method and pass it, say, the mapped path to an HTML page that you want to display. If this gives you any grief you can also try making changes in the PreSendRequestHeaders or the PreSendRequestContent event handlers. The usual caveats apply - "I haven't tested this with browsers other than IE 6.0", blah, blah, blah... but I hope this helps! Cheers, John |
|
#6
|
|||
|
|||
|
I have a similar problem. When our users fail to login they just get a blank page displaying "Error: Access is Denied." How would i redirect them to a custom page using normal ASP (win2000pro IIS 5)?
|
|
#7
|
|||
|
|||
|
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 stright to my custom error page????? Thanks
|
|
#8
|
||||
|
||||
|
Please do not reply to old threads, create a new one on this same section of the forum, it will increase your chances for a reply.
|
|
#9
|
|||
|
|||
|
Hi Elguaro,
I've posted a reply for you on a new thread titled "Handling Custom Error 401.2 (Re-visited)" at http://forums.aspfree.com/t50687/s.html. Cheers, J. |
![]() |
| Viewing: ASP Free Forums > System Administration > Microsoft IIS > Handling Custom Error 401.2 |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|