473,765 Members | 1,909 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 #1
13 5837
I'm trying to use this code:-

Private Sub Global_EndReque st(ByVal sender As Object, ByVal e As
System.EventArg s) Handles MyBase.EndReque st
If Response.Status Code = 401 AndAlso Request.IsAuthe nticated = True Then
Response.ClearC ontent()
Server.Execute( "http://server/tests.aspx")
End If
End Sub

WHICH I CONVERTED TO C# but it seems not to fire:( don't know what 'm
missing
Thanks
private void Global_EndReque st(object sender, System.EventArg s e)

{

if (Response.Statu sCode == 401 && Request.IsAuthe nticated == true)

{

Response.ClearC ontent();

Server.Execute( "http://server/tests.aspx");

}

}

"Patrick.O. Ige" <na********@hot mail.com> wrote in message
news:O8******** ******@TK2MSFTN GP15.phx.gbl...
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 #2
I'm trying to use this code:-

Private Sub Global_EndReque st(ByVal sender As Object, ByVal e As
System.EventArg s) Handles MyBase.EndReque st
If Response.Status Code = 401 AndAlso Request.IsAuthe nticated = True Then
Response.ClearC ontent()
Server.Execute( "http://server/tests.aspx")
End If
End Sub

WHICH I CONVERTED TO C# but it seems not to fire:( don't know what 'm
missing
Thanks
private void Global_EndReque st(object sender, System.EventArg s e)

{

if (Response.Statu sCode == 401 && Request.IsAuthe nticated == true)

{

Response.ClearC ontent();

Server.Execute( "http://server/tests.aspx");

}

}

"Patrick.O. Ige" <na********@hot mail.com> wrote in message
news:O8******** ******@TK2MSFTN GP15.phx.gbl...
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 #3
Fixed it!
forgot it was C#
I for got to add the Handler
"Patrick.O. Ige" <na********@hot mail.com> wrote in message
news:Ob******** *****@TK2MSFTNG P15.phx.gbl...
I'm trying to use this code:-

Private Sub Global_EndReque st(ByVal sender As Object, ByVal e As
System.EventArg s) Handles MyBase.EndReque st
If Response.Status Code = 401 AndAlso Request.IsAuthe nticated = True Then
Response.ClearC ontent()
Server.Execute( "http://server/tests.aspx")
End If
End Sub

WHICH I CONVERTED TO C# but it seems not to fire:( don't know what 'm
missing
Thanks
private void Global_EndReque st(object sender, System.EventArg s e)

{

if (Response.Statu sCode == 401 && Request.IsAuthe nticated == true)

{

Response.ClearC ontent();

Server.Execute( "http://server/tests.aspx");

}

}

"Patrick.O. Ige" <na********@hot mail.com> wrote in message
news:O8******** ******@TK2MSFTN GP15.phx.gbl...
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 #4
Fixed it!
forgot it was C#
I for got to add the Handler
"Patrick.O. Ige" <na********@hot mail.com> wrote in message
news:Ob******** *****@TK2MSFTNG P15.phx.gbl...
I'm trying to use this code:-

Private Sub Global_EndReque st(ByVal sender As Object, ByVal e As
System.EventArg s) Handles MyBase.EndReque st
If Response.Status Code = 401 AndAlso Request.IsAuthe nticated = True Then
Response.ClearC ontent()
Server.Execute( "http://server/tests.aspx")
End If
End Sub

WHICH I CONVERTED TO C# but it seems not to fire:( don't know what 'm
missing
Thanks
private void Global_EndReque st(object sender, System.EventArg s e)

{

if (Response.Statu sCode == 401 && Request.IsAuthe nticated == true)

{

Response.ClearC ontent();

Server.Execute( "http://server/tests.aspx");

}

}

"Patrick.O. Ige" <na********@hot mail.com> wrote in message
news:O8******** ******@TK2MSFTN GP15.phx.gbl...
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 #5
Hi, Patrick.

See my reply in the "Well global.asax didn't work as well as hoped" thread.

There's sample code there.

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.O. Ige" <na********@hot mail.com> wrote in message
news:Ob******** *****@TK2MSFTNG P15.phx.gbl...
I'm trying to use this code:-

Private Sub Global_EndReque st(ByVal sender As Object, ByVal e As
System.EventArg s) Handles MyBase.EndReque st
If Response.Status Code = 401 AndAlso Request.IsAuthe nticated = True Then
Response.ClearC ontent()
Server.Execute( "http://server/tests.aspx")
End If
End Sub

WHICH I CONVERTED TO C# but it seems not to fire:( don't know what 'm
missing
Thanks
private void Global_EndReque st(object sender, System.EventArg s e)

{

if (Response.Statu sCode == 401 && Request.IsAuthe nticated == true)

{

Response.ClearC ontent();

Server.Execute( "http://server/tests.aspx");

}

}

"Patrick.O. Ige" <na********@hot mail.com> wrote in message
news:O8******** ******@TK2MSFTN GP15.phx.gbl...
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 #6
Hi, Patrick.

See my reply in the "Well global.asax didn't work as well as hoped" thread.

There's sample code there.

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.O. Ige" <na********@hot mail.com> wrote in message
news:Ob******** *****@TK2MSFTNG P15.phx.gbl...
I'm trying to use this code:-

Private Sub Global_EndReque st(ByVal sender As Object, ByVal e As
System.EventArg s) Handles MyBase.EndReque st
If Response.Status Code = 401 AndAlso Request.IsAuthe nticated = True Then
Response.ClearC ontent()
Server.Execute( "http://server/tests.aspx")
End If
End Sub

WHICH I CONVERTED TO C# but it seems not to fire:( don't know what 'm
missing
Thanks
private void Global_EndReque st(object sender, System.EventArg s e)

{

if (Response.Statu sCode == 401 && Request.IsAuthe nticated == true)

{

Response.ClearC ontent();

Server.Execute( "http://server/tests.aspx");

}

}

"Patrick.O. Ige" <na********@hot mail.com> wrote in message
news:O8******** ******@TK2MSFTN GP15.phx.gbl...
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 #7
Thx Juan i had a brief look and it seems intersting and clean..
Will give that a try,
Thx
Patrick

*** Sent via Developersdex http://www.developersdex.com ***
Nov 19 '05 #8
Thx Juan i had a brief look and it seems intersting and clean..
Will give that a try,
Thx
Patrick

*** Sent via Developersdex http://www.developersdex.com ***
Nov 19 '05 #9
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
*** Sent via Developersdex http://www.developersdex.com ***
Nov 19 '05 #10

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

Similar topics

11
3273
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
4422
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
5873
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
9566
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9393
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,...
0
10153
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10007
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7371
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
6646
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
5272
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3530
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2800
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.