Hi Laurahn,
Regarding on the "close user session", I'd like to confirm the exact goal
you want to achieve. Generally, for ASP.NET session state you have the
following options to configure or manage it at design-time or runtime:
1. turn on or turn off it in web.config <sessionState> element.
#<sessionState> Element
http://msdn2.microsoft.com/en-us/library/h6bb9cz9(VS.71).aspx
2. You can also set "timeout" value in the above element which control the
timespan after which the runtime will dispose a certain idle sessionstate
3. You can control whether a certain ASPX page can access sessionstate
through the "@Page" directive's "EnableSessionState" attribute:
#@ Page
http://msdn2.microsoft.com/en-us/library/ydy4x04a(VS.71).aspx
4. As other members have mentioned, at runtime, in code, you can explicitly
call "Session.Abandon" method in page to terminate the current session:
#HttpSessionState.Abandon Method
http://msdn2.microsoft.com/en-au/library/system.web.sessionstate.httpsession
state.abandon.aspx
If you wonder when to call it, I think it depend on your application's code
logic, you can put the call into a page event where you want to end a
session and clear all the data in it. If you only want to remove data, but
do not want to terminate the session(and start a new one), you can simply
use the "Session.RemoveAll" or "Session.Clear" to empty the sessionstate
collectiono.
In addition, here is a popular ASP.NET session FAQ article which mentioned
many common tips about using sessionstate:
#Understanding session state modes + FAQ
http://forums.asp.net/7504/ShowPost.aspx
Hope this also helps.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.