Microsoft IIS
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsSystem AdministrationMicrosoft IIS

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old December 9th, 2003, 05:20 AM
sirishacrr sirishacrr is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 2 sirishacrr User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy Handling Custom Error 401.2

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?

Reply With Quote
  #2  
Old December 9th, 2003, 08:40 AM
Doug G Doug G is offline
Grumpier Old Moderator
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Sep 2003
Posts: 10,143 Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 3 Weeks 4 Days 21 h 28 m 48 sec
Reputation Power: 180
What version of Windows and IIS are you using?

Reply With Quote
  #3  
Old December 10th, 2003, 09:47 PM
sirishacrr sirishacrr is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 2 sirishacrr User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Handling Custom Error 401.2

Windows XP Professional & IIS 5.1.

Reply With Quote
  #4  
Old August 18th, 2004, 08:52 AM
er583 er583 is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 2 er583 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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:
Accessing the page

If you set up IIS according to the instructions above, you should now be able to open your application in a Web browser and see a login dialog.

Notice that this dialog is exactly the same as the one produced by our JSP basic authentication example. This is because the dialog box style is specific to the browser (in this case Internet Explorer) and not to the programming language used to develop the application or the server on which it runs.

Basic authentication under Windows, by default, will allow three attempts at a correct user name and password combination. If all three fail, it will send an HTTP 401.2 Unauthorized error. Since basic authentication is performed by IIS and not by ASP.NET, you cannot create customized error pages since ASP.NET will never have a chance to see the request.



Quote:
Originally Posted by sirishacrr
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?

Reply With Quote
  #5  
Old August 31st, 2004, 01:01 AM
iSpeakGeek iSpeakGeek is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 3 iSpeakGeek User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 27 m 8 sec
Reputation Power: 0
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

Reply With Quote
  #6  
Old September 1st, 2004, 05:41 AM
decays decays is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 1 decays User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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)?

Reply With Quote
  #7  
Old March 9th, 2005, 11:24 PM
elguaro elguaro is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2005
Posts: 1 elguaro User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 m 52 sec
Reputation Power: 0
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

Reply With Quote
  #8  
Old March 9th, 2005, 11:30 PM
lewy's Avatar
lewy lewy is offline
Alter Ego Wizard
ASP Free Specialist (4000 - 4499 posts)
 
Join Date: Jun 2004
Location: Edinburg Tx
Posts: 4,376 lewy User rank is General 6th Grade (Above 100000 Reputation Level)lewy User rank is General 6th Grade (Above 100000 Reputation Level)lewy User rank is General 6th Grade (Above 100000 Reputation Level)lewy User rank is General 6th Grade (Above 100000 Reputation Level)lewy User rank is General 6th Grade (Above 100000 Reputation Level)lewy User rank is General 6th Grade (Above 100000 Reputation Level)lewy User rank is General 6th Grade (Above 100000 Reputation Level)lewy User rank is General 6th Grade (Above 100000 Reputation Level)lewy User rank is General 6th Grade (Above 100000 Reputation Level)lewy User rank is General 6th Grade (Above 100000 Reputation Level)lewy User rank is General 6th Grade (Above 100000 Reputation Level)lewy User rank is General 6th Grade (Above 100000 Reputation Level)lewy User rank is General 6th Grade (Above 100000 Reputation Level)lewy User rank is General 6th Grade (Above 100000 Reputation Level)lewy User rank is General 6th Grade (Above 100000 Reputation Level)lewy User rank is General 6th Grade (Above 100000 Reputation Level)  Folding Points: 1009 Folding Title: Novice Folder
Time spent in forums: 1 Month 1 Week 1 Day 21 h 21 m 31 sec
Reputation Power: 1391
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.

Reply With Quote
  #9  
Old March 11th, 2005, 11:44 AM
iSpeakGeek iSpeakGeek is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 3 iSpeakGeek User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 27 m 8 sec
Reputation Power: 0
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.

Reply With Quote
Reply

Viewing: ASP Free ForumsSystem AdministrationMicrosoft IIS > Handling Custom Error 401.2


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway