473,326 Members | 2,104 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Session stuff in app_xxx events

Jon
I think I've found my problem, but not sure what to do about it.

In the application_start, I have an operation that is erroring (on purpose
for my testing procedures). In the Application_error event, I am trying to
set a session var equal to the error message. However, this causes the
application to die. I am assuming that since app_start errored, session
state is not ever being initialized as even doing the following in app_error
causes the app to die:

dim a as string
a=session.sessionid
(I have proved out the above by creating a clean web app that does nothing
else than throw an error in app_start and ties to retrieve sessionid in
app_error...it doesn't work, no session info exists).

Since there is no per-user info at this point in the app's life, I also
can't redirect, so it always goes to the page specified in the web.config
file. Any way around that, either?

So, I need a way to tell if sessions are active or have been initialized for
the application yet so I know if I can safely use them in my error handling
or if I need to do it some other way in those instances where the error
happens in app_start. Can anyone shed light on how that might be done?

--
********************************
Jon
Nov 19 '05 #1
3 1002
"Jon" <ru******@msn.com> wrote in message
news:10*************@corp.supernews.com...
I think I've found my problem, but not sure what to do about it.

In the application_start, I have an operation that is erroring (on purpose
for my testing procedures). In the Application_error event, I am trying to
set a session var equal to the error message. However, this causes the
application to die. I am assuming that since app_start errored, session
state is not ever being initialized as even doing the following in
app_error causes the app to die:

dim a as string
a=session.sessionid
(I have proved out the above by creating a clean web app that does nothing
else than throw an error in app_start and ties to retrieve sessionid in
app_error...it doesn't work, no session info exists).

Since there is no per-user info at this point in the app's life, I also
can't redirect, so it always goes to the page specified in the web.config
file. Any way around that, either?

So, I need a way to tell if sessions are active or have been initialized
for the application yet so I know if I can safely use them in my error
handling or if I need to do it some other way in those instances where the
error happens in app_start. Can anyone shed light on how that might be
done?


Application-level events are a fairly unique time in an application's life.
These events are not for or about a particular user, so you can't use
anything that's user-specific.

Session state is user-specific, so you can't use it at all in
Application-level events.

There's no other magic that I know about.

Even when you're in user-specific code, are you sure you just want to
display the error to the user? I'd suggest implementing the Error
Application_Error event to put the error into the system event log or
something like that. Maybe even e-mail it to your sfaff.
John Saunders
Nov 19 '05 #2
Jon
Perhaps a better question would be to ask how to handle errors in the
application_Start procedure period. Any takers?
"Jon" <ru******@msn.com> wrote in message
news:10*************@corp.supernews.com...
I think I've found my problem, but not sure what to do about it.

In the application_start, I have an operation that is erroring (on purpose
for my testing procedures). In the Application_error event, I am trying to
set a session var equal to the error message. However, this causes the
application to die. I am assuming that since app_start errored, session
state is not ever being initialized as even doing the following in
app_error causes the app to die:

dim a as string
a=session.sessionid
(I have proved out the above by creating a clean web app that does nothing
else than throw an error in app_start and ties to retrieve sessionid in
app_error...it doesn't work, no session info exists).

Since there is no per-user info at this point in the app's life, I also
can't redirect, so it always goes to the page specified in the web.config
file. Any way around that, either?

So, I need a way to tell if sessions are active or have been initialized
for the application yet so I know if I can safely use them in my error
handling or if I need to do it some other way in those instances where the
error happens in app_start. Can anyone shed light on how that might be
done?

--
********************************
Jon

Nov 19 '05 #3
"Jon" <ru******@msn.com> wrote in message
news:10*************@corp.supernews.com...
Perhaps a better question would be to ask how to handle errors in the
application_Start procedure period. Any takers?


Try-Catch?

What do you mean, "how to handle them"? What do you want to do about errors
there?

John Saunders
Nov 19 '05 #4

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

Similar topics

3
by: VijayShankar | last post by:
Can u be more specific on your question Anyway its not like Session variables are available for sometime and not available for sometime. When your session starts it is very much available...
9
by: William LaMartin | last post by:
I have a problem, mentioned here before, of Session and Application variables disappearing at one site but not at others or on my development computer. The problem is illustrated by an example...
5
by: Sean | last post by:
Problem with sessions I have created an application without concern for sessions. As it turns out I think that might be my undoing. What I have: I have an online quiz. I don’t need to know...
17
by: Riaan | last post by:
Hi guys! I have an issue that needs urgent resolution. Imagine this scenario: You have: 1 production server running Windows Server 2003, IIS6 and an instance of MSDE 2000. There is an...
4
by: Mark Rae | last post by:
Hi, I have a site which uses dynamic MasterPages. The selection of the MasterPage to use is determined by an encrypted QueryString. Session_Start looks for the presence of the QueryString,...
20
by: Simon Says | last post by:
Hi, I've a login page in which after authenticating it via the Oracle DB, I will stored the user information into the Session. However, when the Session timeout occurs, all of the user...
4
by: =?Utf-8?B?SmVycnkgQw==?= | last post by:
I have seen several articles about this subject but I was wondering with ajax is this easer. The articles mentioned client callback and the onbeforeunload event of the browser. Can AJAX be used for...
0
by: =?Utf-8?B?am1hZ2FyYW0=?= | last post by:
My program needs to do X when someone 'starts using' their Windows user account, and it should do Y when they 'stop using' their Windows user account. By 'starts using' I mean they log on, unlock...
6
by: =?Utf-8?B?UGF1bA==?= | last post by:
Hi I have a web application vs2005 and it looks like a condition is causing session veriables to be lost. This does not seem to be happening too often. The web application allows uploading and...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.