472,371 Members | 1,399 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

cannot access Session Variables

in the Global.asax Application_EndRequest prodecure
the application do something and it works normally
but when i try to use session
it gives errors "Object reference not set to an instance of an object." i
cannot access a Session variable...

System.Web.HttpContext.Current.Session["CurrentUserID"] = 5;
a = (int)System.Web.HttpContext.Current.Session["CurrentUserID"];

this code doesnt work at the Application_EndRequest

Does anybody tell me why?

Nov 18 '05 #1
3 4821

"Kaya" <cg*****@luckyeye.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
in the Global.asax Application_EndRequest prodecure
the application do something and it works normally
but when i try to use session
it gives errors "Object reference not set to an instance of an object." i
cannot access a Session variable...

System.Web.HttpContext.Current.Session["CurrentUserID"] = 5;
a = (int)System.Web.HttpContext.Current.Session["CurrentUserID"];

this code doesnt work at the Application_EndRequest

Does anybody tell me why?


It probably isn't the Session that is null, but HttpContext.Current.
Apparently there is no HttpContext anymore when the EndRequest fires.

Hans Kesting
Nov 18 '05 #2
ok is there any way to access Session variables
at the Application_EndRequest

"Kaya" <cg*****@luckyeye.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
in the Global.asax Application_EndRequest prodecure
the application do something and it works normally
but when i try to use session
it gives errors "Object reference not set to an instance of an object." i
cannot access a Session variable...

System.Web.HttpContext.Current.Session["CurrentUserID"] = 5;
a = (int)System.Web.HttpContext.Current.Session["CurrentUserID"];

this code doesnt work at the Application_EndRequest

Does anybody tell me why?

Nov 18 '05 #3
I do not believe you can as the Session has ended before the Application_End
event fires. The only thing I can think of is to move your code from
Application_End to Session_End.

Jeff

"Kaya" <cg*****@luckyeye.com> wrote in message
news:uI**************@TK2MSFTNGP12.phx.gbl...
ok is there any way to access Session variables
at the Application_EndRequest

"Kaya" <cg*****@luckyeye.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
in the Global.asax Application_EndRequest prodecure
the application do something and it works normally
but when i try to use session
it gives errors "Object reference not set to an instance of an object." i cannot access a Session variable...

System.Web.HttpContext.Current.Session["CurrentUserID"] = 5;
a = (int)System.Web.HttpContext.Current.Session["CurrentUserID"];

this code doesnt work at the Application_EndRequest

Does anybody tell me why?


Nov 18 '05 #4

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

Similar topics

2
by: mr_burns | last post by:
Hi, i am getting the following errors when running my php script: Warning: Cannot send session cookie - headers already sent by (output started at ...
3
by: Michael J. Astrauskas | last post by:
I have a site where a user logs in and a session variable I created is used to keep track of the fact that the user is logged in. This various pages query a MySQL database to get information...
0
by: Jack | last post by:
Hi, I have the following problem. I have a main data entry form which has a link to a detailed data entry form. The value of the link in the main form is the sum total of all the line items...
8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
0
by: cdginc | last post by:
Hello, I am trying to implement a sales cart application that uses VBScript and writes the data to an Access database. This is a prepackage software that I am trying to customize for my needs. ...
0
by: totierne | last post by:
comp.databases.ms-access, I want to know how to use Oracle views with session variables in Access. The parameterised views in access, are migrated to views with per session variables. The...
4
by: Primo | last post by:
Hi, This problem has been frustrating me for days and I hope you experts can help me out. I am trying to run a command, which I would normally run from the command line, from within my C#...
0
by: bharathreddy | last post by:
Here I will given an example on how to access the session, application and querystring variables in an .cs class file. Using System.Web.HttpContext class. 1) For accesing session variables :...
1
by: chowdary | last post by:
hi, when the user clicks the logout.php the session variables are destroying. my doubt is when the user clicking back, again they are entering into the pages. how to check whether session...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
2
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
1
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
0
DizelArs
by: DizelArs | last post by:
Hi all) Faced with a problem, element.click() event doesn't work in Safari browser. Tried various tricks like emulating touch event through a function: let clickEvent = new Event('click', {...

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.