473,609 Members | 1,831 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Response.Redire ct in Application_Sta rt & Session_Start

csn
Is it possible to have a Response.Redire ct in Global.asax in the
Application_Sta rt and Session_Start events?

We have code in both events, with try-catch blocks, and if an exception is
caught, we wanted to redirect to an error page. But, this doesn't seem to
work.

So, another question is, if an exception is thrown and caught in a catch
block in Application_Sta rt and/or Session_Start, what do we or can we do
with it?

Thanks.
Nov 19 '05 #1
4 6648
You can't do this.
The Application_Sta rt event is not associated with any user, therefore you
cannot redirect a user from it.
If I caught an exception in there I'd probably log it.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"csn" <cs*@nospam.com > wrote in message
news:e7******** *****@TK2MSFTNG P09.phx.gbl...
Is it possible to have a Response.Redire ct in Global.asax in the
Application_Sta rt and Session_Start events?

We have code in both events, with try-catch blocks, and if an exception is
caught, we wanted to redirect to an error page. But, this doesn't seem to
work.

So, another question is, if an exception is thrown and caught in a catch
block in Application_Sta rt and/or Session_Start, what do we or can we do
with it?

Thanks.

Nov 19 '05 #2
You can't do this.
The Application_Sta rt event is not associated with any user, therefore you
cannot redirect a user from it.
If I caught an exception in there I'd probably log it.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"csn" <cs*@nospam.com > wrote in message
news:e7******** *****@TK2MSFTNG P09.phx.gbl...
Is it possible to have a Response.Redire ct in Global.asax in the
Application_Sta rt and Session_Start events?

We have code in both events, with try-catch blocks, and if an exception is
caught, we wanted to redirect to an error page. But, this doesn't seem to
work.

So, another question is, if an exception is thrown and caught in a catch
block in Application_Sta rt and/or Session_Start, what do we or can we do
with it?

Thanks.

Nov 19 '05 #3
re:
Is it possible to have a Response.Redire ct in Global.asax
in the Application_Sta rt and Session_Start events?
The Application_OnS tart event occurs before the first
new session is created, before the Session_OnStart event.

Only the Application and Server built-in objects
are available within Application_OnS tart.

Referencing the Session, Request, or Response objects
in the Application_OnS tart event script causes an error.

However, all the built-in objects are available and
can be referenced in the Session_OnStart event script.

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

"csn" <cs*@nospam.com > wrote in message
news:e7******** *****@TK2MSFTNG P09.phx.gbl... Is it possible to have a Response.Redire ct in Global.asax in the
Application_Sta rt and Session_Start events?

We have code in both events, with try-catch blocks, and if an exception is
caught, we wanted to redirect to an error page. But, this doesn't seem to
work.

So, another question is, if an exception is thrown and caught in a catch
block in Application_Sta rt and/or Session_Start, what do we or can we do
with it?

Thanks.

Nov 19 '05 #4
re:
Is it possible to have a Response.Redire ct in Global.asax
in the Application_Sta rt and Session_Start events?
The Application_OnS tart event occurs before the first
new session is created, before the Session_OnStart event.

Only the Application and Server built-in objects
are available within Application_OnS tart.

Referencing the Session, Request, or Response objects
in the Application_OnS tart event script causes an error.

However, all the built-in objects are available and
can be referenced in the Session_OnStart event script.

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

"csn" <cs*@nospam.com > wrote in message
news:e7******** *****@TK2MSFTNG P09.phx.gbl... Is it possible to have a Response.Redire ct in Global.asax in the
Application_Sta rt and Session_Start events?

We have code in both events, with try-catch blocks, and if an exception is
caught, we wanted to redirect to an error page. But, this doesn't seem to
work.

So, another question is, if an exception is thrown and caught in a catch
block in Application_Sta rt and/or Session_Start, what do we or can we do
with it?

Thanks.

Nov 19 '05 #5

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

Similar topics

2
3389
by: Jeanne Louw | last post by:
Hi Why would this happen? The Application_Start and Session_Start events fires on each page request on my website. SessionID stays the same between page requests. <sessionState mode="InProc" in WebConfig.> Session state is also not set to readonly in any page directives. I set a session variable in the Session_Start event that gets changed
6
2727
by: Ober | last post by:
I'm having trouble with my security model, Application_Start, and accessing my database. My ASP.NET app is only going to be running in an intranet environment (not on the public Internet). The production environment will have installed everything locally (i.e., IIS, SQL Server, .NET Framework, etc., all on a Win2k Server).
0
352
by: csn | last post by:
Is it possible to have a Response.Redirect in Global.asax in the Application_Start and Session_Start events? We have code in both events, with try-catch blocks, and if an exception is caught, we wanted to redirect to an error page. But, this doesn't seem to work. So, another question is, if an exception is thrown and caught in a catch block in Application_Start and/or Session_Start, what do we or can we do with it?
7
2441
by: Gordon Smith | last post by:
I have four (4) ASP.NET Web applications/Web sites on a IIS/6 - Windows Server 2003 production server. 3 of them work fine. I just installed the 4th one and it's Application_Start event is not firing. I have double-checked everything (and rechecked) and I haven't found anything that would explain why the Application is not starting. Here is what I have done so far to troubleshoot this: In IIS Manager I have ensured that there is a...
0
2106
by: SeanGallavan | last post by:
Our Environment: Two network load balanced (using Microsoft NLB software) webservers with session maintained in a SQL Server database. NLB is configured with no affinity settings and two network cards in each machine. Machine keys are identical on both webservers. There is no anti-virus software installed. SQL Server database is storing session information as specified by Microsoft guidelines.
6
2221
by: Joe Befumo | last post by:
I just created the default personal site project in Visual Studio 2005, and it worked perfectly -- very nice. Next, I'd like to import some stat-capture code that I have working in a Visual Studio 2003 asp,net project. The first think I noticed is that in the 2003 project, there's a global.asax and a global.asax.vb file, with the code being in the latter. Since the 2005 project had a routine directly in the global.asax file, I moved it to...
2
1378
by: Mark Rae | last post by:
Hi, I have a fairly simple site, the vast majority of which is available to everyone on the public internet. However, the site has one section which requires logon via the standard username-password combination. The usernames and passwords are stored in encrypted form in SQL Server 2000. To prevent people trying to access the pages in the secure section, I used
4
2168
by: =?Utf-8?B?bWFzbWl0aA==?= | last post by:
Can you restart an ASP.NET application in the Application_Start event when an error occurs so the next request for the application will fire the Application_Start event again? This would allow the application to recover without intervention if the problem is a database server is temporarily offline or other external source of data being loaded in the Application_Start event having a problem. I usually set up a SQL Dependency in the...
0
894
by: dhanashivam | last post by:
Hi all, In my application i used a session variables which is declared in the session_start of the global.asax. This session varaible is assigned by a new value and login page. this session value remains in the entire application. but my problem is: i delete a directory in a page and redirect to another page. now the session goes clear and the application_start of the global.asax is called. i dont know why it does in this manner.
0
8579
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
8555
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
8232
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
8408
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...
1
6064
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
5524
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
4098
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2540
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
0
1403
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.