Environment is Server2003,IIS6 ,Asp.net 2,VisualStudio2 005,SQl2005.
1. Event viewer showing lots of session abandon errors.
asp.nt 2.0.50727.0
web event id: 1309
event code 3005 An unhandled exception has occurred
Thread ID: 8
Thread account name: NT AUTHORITY\SYSTE M
Is impersonating: False
Stack trace: at System.Web.Http Application.get _Response()
at ASP.global_asax .Session_End(Ob ject sender, EventArgs e)
Have a very basic intranet beginners site. After a person logs in, they can click a button and logout. Here's the code for that (just in case it's causing the error): - Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
-
If Not Page.IsPostBack Then
-
If Request("lo") = "1" Then
-
System.Web.Security.FormsAuthentication.SignOut()
-
Session.Abandon()
-
End If
-
End If
-
End Sub
Here's the global.asax: - Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
-
Response.Cookies.Clear()
-
End Sub
I'm very new at this and would appreciate some input...Thanks.
5 5951
Thanks for outlining your platform. I don't understand what your problem is - are you getting an error? If so what is it?
See above repeated here - No error to the client during the process, but lots of errors in the event view:
asp.nt 2.0.50727.0
web event id: 1309
event code 3005 An unhandled exception has occurred
Thread ID: 8
Thread account name: NT AUTHORITY\SYSTE M
Is impersonating: False
Stack trace: at System.Web.Http Application.get _Response()
at ASP.global_asax .Session_End(Ob ject sender, EventArgs e)
My bad - In ASP.NET 2.0, the Session object is not "Live" until something has been added to it. Is it possible that you are trying to abandon what is not there?
Have you tried abandon and then signout? Is the cookie being removed before the abandon? HTH.
The message seems to imply the end event is causing a problem. Could it be that it's looking for a response.cookie object that isn't there because it's been abandoned through the button onClick event (or timed out because the client just left the machine there and walked away past the set time out)? Would something like this prevent the error?
If IsDBNull(Respon se.Cookies) = False Then
Response.Cookie s.Clear()
End If
Thanks, Janet
This is a good idea. Unfortunately, we are left with debugging which like fishing can take time. I still think that session has ended before you abandon and this causes the errors.
I have found some FAQs that may be helpful: Q: In Proc mode, why do I lose all my session occasionally?
A: InProc - Session state will be lost if the worker process (aspnet_wp.exe) recycles, or if the appdomain restarts. It's because session state is stored in the memory space of an appdomain. The restart can be caused by the modification of certain config files such as web.config and machine.config, or any change in the \bin directory (such as new DLL after you've recompiled the application using VS) For details, see KB324772. In v1, there is also a bug that will cause worker process to restart. It's fixed in SP2 and in v1.1. See KB321792.
If you're using IIS 6.0, you may want to go to IIS Manager, go to Application Pools/DefaultAppPool, and see if any of the parameters on the Recycling and Performance tabs are causing the IIS worker process (w3svc.exe) to shutdown.
For more details about app recycling, see my other FAQ: http://www.asp.net/Forums/ShowPost.aspx?t abindex=1&PostI D=232621 Q: Why isn't Session_End fired?
A: This is one of the most frequently asked question.
1. Remember Session_End event is supported only in InProc mode.
2. Session_End won't be fired if you close your browser. HTTP is a stateless protocol, and the server has no way to know if your browser has closed or not.
3. Session_End will be fired only (i) after n minutes of inactivity (n = timeout value), or (ii) if someone calls Session.Abandon ().
4. For case (i) (pt. 3), Session_End will be run by a background thread, which implies:
a. Your code in Session_End is running using the worker process account. You may have permission problem if you're accessing resource such as database.
b. If an error happens in Session_End, it will fail silently.
5. For case (ii), please note that in order for Session_End to be fired, your session state has to exist first. That means you have to store some data in the session state and has completed at least one request.
6. Again for case (ii), Session_End will be called only if the abandoned session is actually found. As a result, if you create and abandon a session inside the same request, because the session hasn't been saved and thus can't be found, Session_End won't be called. This is a bug in v1 and upcoming v1.1. Q: Why are my Session variables lost frequently when using InProc mode? A: Probably because of application recycle.
See http://support.microso ft.com/default.aspx?sc id=kb;en-us;Q316148
In v1, there is also a bug that will cause worker process to restart. It's fixed in SP2 and v1.1. See http://support.microso ft.com/default.aspx?sc id=kb;EN-US;321792
For more details about app recycling, see my other FAQ:
http://www.asp.net/Forums/ShowPost.aspx?t abindex=1&PostI D=232621 Q: What is the difference between Session.Abandon () and Session.Clear() ?
A:The major practical difference is that if you call Session.Abandon (), Session_End will be fired (for InProc mode), and in the next request, Session_Start will be fired. Session.Clear( ) just clears the session data without killing it. Q: How do I use session state with web services?
A: The extra trick needed is on the caller side. You have to save and store the cookies used by the web service. See the MSDN documentation on HttpWebClientPr otocol.CookieCo ntainer property.
However, please note if you're using proxy object to call a web service from your page, the web service and your page cannot share the same session state due to architecture limitation.
This can be done if you call your web service through redirect. Q: In Session_End, I tried to do some cleanup job using SQL but it failed. Why?
A: First, Session_End is supported only in InProc mode.
Second, Session_End is run using the account which runs the worker process (aspnet_wp.exe) , which can be specified in machine.config. Therefore, in your Session_End, if you connect to SQL using integrated security, it will use that worker process account credential to connect, and may fail depending on your SQL security settings. Q: In InProc mode, I change the timeout value of a session programmaticall y, and that causes my Session_End to be called. Why?
A:It is a a bug of InProc mode. If you change a session's timeout to a different value, Session_End will be called (but not Session_Start). We will looking into that in v2 and see if we can fix it.
Hope that something here helps :).
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Xizor |
last post by:
Let's say I run a server. I have two people using the server. Bill and Joe.
Bill is at address.com/bill and Joe is at address.com/joe.
Let's say Joe and Bill are both using PHP with sessions on their web pages.
Let's say they both create the session variable $_SESSION. Each uses
yo for a different purpose.
Now we have a user accessing address.com. He goes to Bill's site and his
session his started with the $_SESSION created.
|
by: Jason Telisch |
last post by:
I read and reread the PHP manual about sessions, and I have a quick
question. What causes the session id to change? I tried destroying the
session and unsetting the session vars, but it maintains the same id.
Just so you know, I don't need to make the session id change for any
reason. I'd just like to know what to avoid since I'm going to be storing
data the user enters with their sessionid and I'd like to make sure that
they can...
|
by: Mladen Gogala |
last post by:
How can I share variables between two processes?
Here is my problem?
File test1.php:
-------------------------------------------------------------------
<?php
session_start();
$var1="This should";
$var2="be displayed";
$_SESSION=$var1;
|
by: lester |
last post by:
a pre-beginner's question:
what is the pros and cons of .net, compared to ++
I am wondering what can I get if I continue to learn C# after I have learned
C --> C++ --> C# ??
I think there must be many know the answer here.
thanks
|
by: optimistx |
last post by:
As a beginner in javascript I had a question. I was reading FAQ and posts
here.
I became very unhappy: Obviously this group is mainly for wise, pedantic,
unkind etc people, who already know everything about javascript, and want
to prove that to everyone in a very harsh way?
Therefore, I skip the question, and we can go directly to the following
posts:
| |
by: Jeff |
last post by:
....another beginnger question.
I have a web application in .net v2 VB that requires multiple reads from sql tables where
each read is slightly different - so the sql select statements also differ frequently. I've created a
few functions in an .ascx file to handle these reads and send them back to the main code.
2 examples are below. Each works - the first returns a single integer value, the second returns the entire row
that contains a...
|
by: Roman Zeilinger |
last post by:
Hi
I have a beginner question concerning fscanf.
First I had a text file which just contained some
hex numbers:
0C100012
0C100012
....
|
by: Ben Keshet |
last post by:
I have a probably simple beginner's question -
I have a script that I am currently able to print its output. instead,
i want to write it into a file - I tried different versions of write()
but might have gotten the syntax wrong. the variable I want to write is
a line from a file I am reading:
"...
f = open('receptor.mol2', 'r')
line = f.readline()
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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...
| |
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,...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |