473,387 Members | 1,573 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,387 software developers and data experts.

Close User Session

How can i configure my application for closing the session ? How can i use
the session end for closing the session ?
Mar 14 '07 #1
13 2068
Session end is only the event fired when a session is ended. To end the
user's session you would use Session.Abandon() I believe. It will
automatically close the session after 20 minutes of inactivity anyways, and
unload the application itself after the last session is closed.
--
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006

"Laurahn" <le*****@newsgroups.nospamwrote in message
news:e1**************@TK2MSFTNGP03.phx.gbl...
How can i configure my application for closing the session ? How can i use
the session end for closing the session ?

Mar 14 '07 #2
On Mar 14, 11:17 pm, "Laurahn" <leme...@newsgroups.nospamwrote:
How can i configure my application for closing the session ? How can i use
the session end for closing the session ?
Configure a timeout or call Session.Abandon()

Mar 14 '07 #3
Thanks Mark.

But, i want to know what code I have to put into my app for that hapends.

Can i use a button?

i've read about put some code on Global.asax
Mar 14 '07 #4
How i Configure a timeout?

Where have I to call Session.Abandon()?
Mar 14 '07 #5
"Laurahn" <le*****@newsgroups.nospamwrote in message
news:uN**************@TK2MSFTNGP03.phx.gbl...
But, i want to know what code I have to put into my app for that hapends.

Can i use a button?

i've read about put some code on Global.asax
In Global.asax, you have an event called Session_End - this is the event
which fires (so long as your Session is InProc) when the Session ends.

Under normal circumstances, the Session ends for two reasons:

1) it has timed out automatically, by default after 20 minutes of
inactivity, though this figure can be changed

2) it has been ended explicitly ("torn down", to use the jargon)

You may be familiar with logging out of your on-line banking application by
clicking a "Logout" button or whatever - it is the code behind such a button
where you would place the Session.Abandon() code.
Mar 14 '07 #6
Make a button on your web page. Give it text of "Log out". In its
server-side click event handler, simply write: Session.Abandon()

And/Or in your Web.Config file, find the section that is already there about
the session timeout and change the time from 20 minutes to something else.

"Laurahn" <le*****@newsgroups.nospamwrote in message
news:u$****************@TK2MSFTNGP06.phx.gbl...
How i Configure a timeout?

Where have I to call Session.Abandon()?


Mar 15 '07 #7
You response doesn't really address the question. The Session_End event
handler is of no use when you are trying to end the session, only after (or
as) the session has ended.

I have been working with sessions for many, many years and you are the first
person to use the "torn down" jargon you speak of that I've ever heard.
It's not a good idea to introduce jargon that is not widely used.
"Mark Rae" <ma**@markNOSPAMrae.comwrote in message
news:uh**************@TK2MSFTNGP03.phx.gbl...
"Laurahn" <le*****@newsgroups.nospamwrote in message
news:uN**************@TK2MSFTNGP03.phx.gbl...
>But, i want to know what code I have to put into my app for that hapends.

Can i use a button?

i've read about put some code on Global.asax

In Global.asax, you have an event called Session_End - this is the event
which fires (so long as your Session is InProc) when the Session ends.

Under normal circumstances, the Session ends for two reasons:

1) it has timed out automatically, by default after 20 minutes of
inactivity, though this figure can be changed

2) it has been ended explicitly ("torn down", to use the jargon)

You may be familiar with logging out of your on-line banking application
by clicking a "Logout" button or whatever - it is the code behind such a
button where you would place the Session.Abandon() code.

Mar 15 '07 #8
I don't believe the application is unloaded after the last session is
unloaded. I belive the application sits idle until it crashes or is taken
off-line, but I don't believe it just ends itself.
"Mark Fitzpatrick" <ma******@fitzme.comwrote in message
news:uQ**************@TK2MSFTNGP05.phx.gbl...
Session end is only the event fired when a session is ended. To end the
user's session you would use Session.Abandon() I believe. It will
automatically close the session after 20 minutes of inactivity anyways,
and unload the application itself after the last session is closed.
--
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006

"Laurahn" <le*****@newsgroups.nospamwrote in message
news:e1**************@TK2MSFTNGP03.phx.gbl...
>How can i configure my application for closing the session ? How can i
use the session end for closing the session ?


Mar 15 '07 #9
"Scott M." <s-***@nospam.nospamwrote in message
news:Oz**************@TK2MSFTNGP06.phx.gbl...
Make a button on your web page. Give it text of "Log out". In its
server-side click event handler, simply write: Session.Abandon()
Wish I'd thought of that... ;-)
Mar 15 '07 #10
You did, but apparently this person wants us to come over and type it in for
him/her.
"Mark Rae" <ma**@markNOSPAMrae.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
"Scott M." <s-***@nospam.nospamwrote in message
news:Oz**************@TK2MSFTNGP06.phx.gbl...
>Make a button on your web page. Give it text of "Log out". In its
server-side click event handler, simply write: Session.Abandon()

Wish I'd thought of that... ;-)

Mar 15 '07 #11
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 <sessionStateelement.

#<sessionStateElement
http://msdn2.microsoft.com/en-us/lib...z9(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/lib...4a(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/lib...te.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/subscripti...ult.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/subscripti...t/default.aspx.

==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.


Mar 15 '07 #12
To Empty Session state there are so many ways depends on requirements:
i am taking some cases:

1. Suppose u want to End the Particular Session state

Session["KEY"] = null;
Session["abc"] = null;
OR
Session["abc"] = "";

2. Suppose u want to End all the Session's in application

Session.Abandon();
OR
Session.Clear();

So here u go.......
Nitin Sharma NXS

*** Sent via Developersdex http://www.developersdex.com ***
Mar 15 '07 #13
To Empty Session state there are so many ways depends on requirements:
i am taking some cases:

1. Suppose u want to End the Particular Session state

Session["KEY"] = null;
Session["abc"] = null;
OR
Session["abc"] = "";

2. Suppose u want to End all the Session's in application

Session.Abandon();
OR
Session.Clear();

So here u go.......
Nitin Sharma NXS

*** Sent via Developersdex http://www.developersdex.com ***
Mar 15 '07 #14

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

Similar topics

9
by: Pack Fan | last post by:
I've noticed that session variables will persist on Mac IE even after all browser windows have been closed. One must quit the program to clear the session variables. This presents a security risk...
1
by: Xing Rong | last post by:
I have an asp page to authenticate users by checking their uid and password: --------------------------------------- If (request("UID") = "user" and request("Password") = "pwd") then...
4
by: Champika Nirosh | last post by:
Hi All, I have a asp .net app and it is a online test application so tracking the user behaviour is very important. The problem is in what way I can identify the user logoff time if it happens...
4
by: Pierke | last post by:
Hey guys out there, I really need your help, i am building up a web site, so for security reasons i need to do "some things" before the user log off, and i indeed do it. Now the matter is that...
20
by: Harry | last post by:
My development environment is Framework 1.1, ASP.Net and IE 6.X. I have logout button in all the screens in the application. I am doing database activity when the user clicks on logout button....
1
by: RJN | last post by:
Hi Sorry for posting again. I open a few pop-up windows from a main window. If session time out occurs in either the main window or the pop-up windows ,I redirect the user to login screen....
4
by: Bill Manring | last post by:
I need to capture the event when the user closes the browser in my application. I have some code in the session_End event, which works fine when the session times out, but I need to end the...
10
by: newbie | last post by:
My application_end event in global.asax is not working as-is. In order to debug, I want to call it from another file, say debug.aspx through a button, e.g. "end application". How do I call...
20
by: luqman | last post by:
If user login with the login control in ASP.Net 2005 and then just close the browser and then open the browser again, the login status shows, User still Login? Any idea, how to Logout the User...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
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...

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.