473,772 Members | 3,712 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Handling Custom Errors 401.2

How can i get to redirect users if the get error 401.2 to another page?
I guess i should be possible to do it in Global.asax?
Or are there any better ways around it..
Any better solutions in ASP.NET 2.0?
Patrick
Nov 19 '05
13 5840
Hi, Patrick.

IIS defines a number of different 401 errors
that indicate a more specific cause of the error. :

401 - Access denied.
401.1 - Logon failed.
401.2 - Logon failed due to server configuration.
401.3 - Unauthorized due to ACL on resource.
401.4 - Authorization failed by filter.
401.5 - Authorization failed by ISAPI/CGI application.
401.7 - Access denied by URL authorization policy on the Web server.
This last error code is specific to IIS 6.0.

It might be that you have to take *those* into consideration
if you want a *specific* error code captured.

I'd try using 401.1 to test catching a "logon failed" exception

Mind you, it could very well be that Windows Integrated Authentication
preempts any IIS authorization scheme.

Maybe testing if the 401 exception works with Forms Authentication would
help us find out if Windows Authentication does preempt IIS's authentication.

Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
=============== =======

"Patrick Olurotimi Ige" <na********@hot mail.com> wrote in message
news:Oj******** ******@TK2MSFTN GP10.phx.gbl...
Thx Juan for the hint but with the code you posted i can't capture the
HTTPEXCEPTION 401 but exception 404 works if i try browsing an ASPX page
that doesn;'t exist

I have included:-

Case 401
errMessage &= "You are not authorised to view this page."

to loop through but it doesn't seem to work.

I have Windows Integrated
Auth and Basic Auth with a selected DOMAIN.

Any clue why it isn't working?
Thanks

Nov 19 '05 #11
Thanks Juan
Wow i didn't know the status code were this lot...
I was actually thinking of looking through specific ones but i taught
401 will do since i just wnated to look in ACCESS DENIED error..becos i
got it working before but when i came across your solution it was more
cleaner..
I would actually test it for both FORMS AUTH and WINDOWS AUTH and feed
you back.
Patrick
*** Sent via Developersdex http://www.developersdex.com ***
Nov 19 '05 #12
Hi Juan...
I don;t think by adding 401.1 or 401.3 would do the trick
I tried testing with those but no luck..
404 works fine
And i know i get the ACCESS DENIED Error message 401.3 for example
And incase i use IIS version 5
Patrick

*** Sent via Developersdex http://www.developersdex.com ***
Nov 19 '05 #13
Thanks for testing this out, Patrick.
Now we know a bit more than before ... ;-)


Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
=============== =======

"Patrick Olurotimi Ige" <na********@hot mail.com> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
Hi Juan...
I don;t think by adding 401.1 or 401.3 would do the trick
I tried testing with those but no luck..
404 works fine
And i know i get the ACCESS DENIED Error message 401.3 for example
And incase i use IIS version 5
Patrick

*** Sent via Developersdex http://www.developersdex.com ***

Nov 19 '05 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
3275
by: Master of C++ | last post by:
Hi, I am writing a simulation package in C++, and so far I've written about 8000 lines of code and have about 30 classes. I haven't used C++ exceptions so far (for various reasons). The only two "resources" I use are memory and file I/O and whenever there is a memory allocation failure or file I/O failure I just simply call a custom assert-type function to check, print a error message and abort. This seems to be OK for now (for the...
2
3028
by: Steve Jorgensen | last post by:
When writing VB or VBA code that works with databases or other external libraries that cannot be trusted to automatically do the right thing when references to their objects are arbitrarily released, some thought must be put into how to make sure the objects will all be closed and released in the correct order, even in the result of an error. This requirement can make our code really ugly, even following the best of commonly known best...
21
4424
by: Anthony England | last post by:
Everyone knows that global variables get re-set in an mdb when an un-handled error is encountered, but it seems that this also happens when the variable is defined as private at form-level. So if "global variables get re-set" doesn't tell the whole story, then what does? ***please note*** I'm not looking for a solution - I'm looking for a more detailed description of what happens when an un-handled error occurs - possibly with help file...
4
2525
by: aaj | last post by:
Hi all I have an automated application, that runs in the middle of the night. If certain 'non system' errors occur (things like malformed files, missing files etc..), I send an automatic Email and write a record to the database. This is handled in a class. When these errors occur, once Emailed and written I want to just end the App, simple as that.
2
5874
by: Rajeev Soni | last post by:
Hi, Considering the scenario for handling exceptions in Web Application where we have Presentation layer, Business layer and Data Access layer; if there any exception is occurred in DAL, what is the best thing to do: 1. Dont catch the exception in DAL and let it prop up to the Application level and the Global.Application_Error event log it to any source and show let ASP.NET show custom error page provided in Web.Config file. OR 2....
4
1548
by: Paul | last post by:
I have written a custom dll that I put inside the /bin directory of a production IIS server. Inside the config file of the web application i have added the following setting: <httpModules> <add name="ExceptionManagerHTTPModule" type="Digiscribe.HTTPModule.ExceptionManagerHTTPModule, HTTPModule" /> </httpModules> In this dll I have inherited from the IHttpModule which in turn has given me
1
483
by: michaeltorus | last post by:
Hi I'm currently designing a new web application in .Net. I've pretty covered everything, apart from error handling. There seems to be a few different way to do this, but something I've read often is that loading all your code with lots of try / catch blocks is not the best way. My application is made up of a number of different sub applications. A CRM Package, with financial services, compliance and commisions etc etc. Each part has...
4
7618
by: James Radke | last post by:
Hello, I am looking for guidance on best practices to incorporate effective and complete error handling in an application written in VB.NET. If I have the following function in a class module (note that this class module represents the business layer of code NOT the gui layer): Public Function Test(ByVal Parm1 As Integer, ByVal Parm2 As Integer) As SqlDataReader ' Declare the SQL data layer class Dim oSQL As New...
2
2145
by: tshad | last post by:
This has been driving me crazy. I have been trying to get the error handling working on my system and can get parts of it working and others won't work at all. I found that you can't access session variables from Application_Error event, but I need to so I don't need to set up traces to see what they are during an error. I am emailing the error condition to myself when it happens.
7
1686
by: Jason Kester | last post by:
Best I can tell, there are three basic ways you can deal with global error handling in ASP.NET. Namely: 1. Derive all your pages from a custom Page class, and override OnError() 2. Specify a custom 500 handler in Web.Config 3. Specify a custom 500 handler in IIS
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10038
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9912
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8934
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7460
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6715
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2850
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.