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?
Thanks. 4 6612
You can't do this.
The Application_Start 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*************@TK2MSFTNGP09.phx.gbl... 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?
Thanks.
You can't do this.
The Application_Start 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*************@TK2MSFTNGP09.phx.gbl... 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?
Thanks.
re: Is it possible to have a Response.Redirect in Global.asax in the Application_Start and Session_Start events?
The Application_OnStart 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_OnStart.
Referencing the Session, Request, or Response objects
in the Application_OnStart 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*************@TK2MSFTNGP09.phx.gbl... 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?
Thanks.
re: Is it possible to have a Response.Redirect in Global.asax in the Application_Start and Session_Start events?
The Application_OnStart 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_OnStart.
Referencing the Session, Request, or Response objects
in the Application_OnStart 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*************@TK2MSFTNGP09.phx.gbl... 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?
Thanks. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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"...
|
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). ...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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,...
|
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...
|
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,...
|
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...
|
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,...
| |