Last post Jul 13, 2014 05:29 AM by RajasekharBabu
Jul 11, 2014 03:58 PM|RajasekharBabu|LINK
iam geting error in Global.asax page in asp.net 4.0.Please help me how to clear that error
The error deatails:
"Object reference not set to an instance of an object." this message can be dispaly with in following code:
void Session_End(object sender, EventArgs e)
HttpContext.Current.Response.Write("Session_End" + "<br/>");
// Code that runs when a session ends.
// Note: The Session_End event is raised only when the sessionstate mode
// is set to InProc in the Web.config file. If session mode is set to StateServer
// or SQLServer, the event is not raised.
How to clear this error anybody help me soon very urgent now
Advance thank you to very viewers and answers also.
Jul 11, 2014 04:03 PM|BrockAllen|LINK
There is no current http request when session ends. It's a timeout when the user has been inactive.
Jul 11, 2014 04:09 PM|RajasekharBabu|LINK
What Modification i need to do there? Please tell me code soon i need very urgent .Advance thanks
Jul 11, 2014 04:16 PM|BrockAllen|LINK
You misunderstood what I said. The HttpContext is not available in session end.
Jul 11, 2014 04:21 PM|RajasekharBabu|LINK
I wrote like given below and also iam geting error .That error is "Response is not available in this context."
Response.Write("Session_Ended" + "<br/>");
Please answer soon .I need very urgent BrockAllen.
Advance thanks BrockAllen
Jul 12, 2014 09:00 PM|markfitzme|LINK
You can't use Response.Write in the session_end event.
There are certain things you can't do in session end, using the Response object is one of them. You have to understand that, by nature, the web is not statefull. When a user visits your site, he disconnects from the server the millisecond that all the data
for your page is retrieved. After that there is no direct link, until the user makes another request from your site. Session_End occurs when there has been no activity with the user. There is no connection to the browser here at all so you can't communicate
with it in any way. Most likely, the user has browsed away and is long gone from your site. There is no way to communicate with the client in Session_End. The purpose of this event is to give you an opportunity to make any actions, such as notifying a database
that there is one less user active in the system, cleaning up temporary database items that were related to the user's session, etc. and not to attempt to communicate.
Jul 13, 2014 05:29 AM|RajasekharBabu|LINK
i clear that error now.Thanks for everybody.