Does anyone know how I can kill a session by session ID ?
--
Goofy 13 9949
Yes, I understand this. The problem I have is when users who close and
reopen the application several times and each time they generate new
sessions and consume resources.
What really need is to invoke something like to be run from session start.
Note Each time I start a session I log the username and session ID in a
table. Each time the session ends I delete the record for that user /
session ID. So on session start
If CheckSessionDat abaseRecordExis ts( Session("userNa me")
,Session("sessi onID") ) then
DeleteSessionDa tabaseRecord(Se ssion("userName "),Session("ses sionID")
'//This is what I need
Session.kill(Se ssionID)
'//
End if
this would fire the session end event for that particular session and
release its state storage etc.
Cheers
"Manish Bafna" <Ma*********@di scussions.micro soft.comwrote in message
news:6A******** *************** ***********@mic rosoft.com...
Hi,
I have read that unless you have configured to use cookieless session,the
ASP.NET by default uses cookies to maintain sessions.In fact cookie with
name
of sessionid is created on hard disk.So if we delete this cookie i think
we
would be able to abandon session by sessionid.Find below MSDN
Documentation
on how to delete cookie from user's machine:
Deleting a cookie-physically removing it from the user's hard disk-is a
variation on modifying it. You cannot directly remove a cookie because the
cookie is on the user's computer. However, you can have the browser delete
the cookie for you. The technique is to create a new cookie with the same
name as the cookie to be deleted, but to set the cookie's expiration to a
date earlier than today. When the browser checks the cookie's expiration,
the
browser will discard the now-outdated cookie. The following code example
shows one way to delete all the cookies available to the application:
C# Copy Code
HttpCookie aCookie;
string cookieName;
int limit = Request.Cookies .Count;
for (int i=0; i<limit; i++)
{
cookieName = Request.Cookies[i].Name;
aCookie = new HttpCookie(cook ieName);
aCookie.Expires = DateTime.Now.Ad dDays(-1);
Response.Cookie s.Add(aCookie);
}
Thanks and Regards,
Manish Bafna.
MCP and MCTS
"Goofy" wrote:
>Does anyone know how I can kill a session by session ID ?
-- Goofy
"Goofy" <me@mine.comwro te in message
news:uK******** *****@TK2MSFTNG P02.phx.gbl...
Yes, I understand this. The problem I have is when users who close and
reopen the application several times and each time they generate new
sessions and consume resources.
Yes, that's right - this behaviour is by design - hack about with it at your
peril...!
What really need is to invoke something like to be run from session
start. Note Each time I start a session I log the username and session ID
in a table. Each time the session ends I delete the record for that user /
session ID. So on session start
If CheckSessionDat abaseRecordExis ts( Session("userNa me")
,Session("sessi onID") ) then
As you correctly state above, closing and re-opening the application
generates a *new* session. As a *new* session will have a *new* SessionID
(OK, this isn't absolutely always the case in every single scenario, but it
almost always is), surely the above code will (almost) never return True
because the new session will (almost) always have a new SessionID...?
'//This is what I need
Session.kill(Se ssionID)
'//
Every single method of the Session object operates on the *current*
session - there is no mechanism for passing in a SessionID... http://msdn2.microsoft.com/en-gb/library/ms524319.aspx
If you mean from outside the session itself ( like in another application ), you can't.
If from within the same session : Session.Abandon
Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== =====
"Goofy" <me@mine.comwro te in message news:ur******** ******@TK2MSFTN GP02.phx.gbl...
Does anyone know how I can kill a session by session ID ?
Goofy
In my scenario, each time a user gets a new session, they get a record in
the whosOn table which records the time, userName and session ID.
So they access the application, close the window and access the application
again before the first session times out two sessions would be recorded in
whosOn. My mistake on the function, it should have read.
If CheckSessionDat abaseRecordExis ts( Session("userNa me") Then
eithe kill the session for that record or simply delete it from the
database
End If
Now created the new record.
The approach I have taken in light of what you say and what I have read, is
that I simply delete the previous records with the same username before
creating a new one. When the old sessions time out there will be nothing for
them to delete.
It would be tidier though if you could kill the old sessions to preserve
resources. Its perhaps not so important in small applications, but when
there are hundreds of users on line, this could lead to problems.
Thanks for your input though.
>> If CheckSessionDat abaseRecordExis ts( Session("userNa me") ,Session("sess ionID") ) then
As you correctly state above, closing and re-opening the application
generates a *new* session. As a *new* session will have a *new* SessionID
(OK, this isn't absolutely always the case in every single scenario, but
it almost always is), surely the above code will (almost) never return
True because the new session will (almost) always have a new SessionID...?
> '//This is what I need Session.kill(Se ssionID)
If you use this product to manage session (the license may be free
if you only have one server), you can definitely do this.
It supports in memory session access from within or
outside the individual session. You can also share session
in memory across servers on a farm and application domains.
It basically gives you way to create a unique key and reference
what is stored under that key from any app on any server
regardless of application domain. http://www.eggheadcafe.com/articles/scaleout_server.asp
--
Robbe Morris - 2004-2006 Microsoft MVP C#
I've mapped the database to .NET class properties and methods to
implement an multi-layered object oriented environment for your
data access layer. Thus, you should rarely ever have to type the words
SqlCommand, SqlDataAdapter, or SqlConnection again. http://www.eggheadcafe.com/articles/..._generator.asp
"Goofy" <me@mine.comwro te in message
news:ur******** ******@TK2MSFTN GP02.phx.gbl...
Does anyone know how I can kill a session by session ID ?
--
Goofy
I'll take a look, thanks for your help.
"Robbe Morris [C# MVP]" <jo*****@joe.co mwrote in message
news:B8******** *************** ***********@mic rosoft.com...
If you use this product to manage session (the license may be free
if you only have one server), you can definitely do this.
It supports in memory session access from within or
outside the individual session. You can also share session
in memory across servers on a farm and application domains.
It basically gives you way to create a unique key and reference
what is stored under that key from any app on any server
regardless of application domain.
http://www.eggheadcafe.com/articles/scaleout_server.asp
--
Robbe Morris - 2004-2006 Microsoft MVP C#
I've mapped the database to .NET class properties and methods to
implement an multi-layered object oriented environment for your
data access layer. Thus, you should rarely ever have to type the words
SqlCommand, SqlDataAdapter, or SqlConnection again. http://www.eggheadcafe.com/articles/..._generator.asp
"Goofy" <me@mine.comwro te in message
news:ur******** ******@TK2MSFTN GP02.phx.gbl...
>Does anyone know how I can kill a session by session ID ?
-- Goofy
"Goofy" <me@mine.comwro te in message
news:u5******** ******@TK2MSFTN GP03.phx.gbl...
It would be tidier though if you could kill the old sessions to preserve
resources. Its perhaps not so important in small applications, but when
there are hundreds of users on line, this could lead to problems.
Several options, then:
1) Make the sessions as small as possible
2) Reduce the Session.Timeout from its default of 20 minutes
3) Add more memory to your webserver
4) Use SQL Server to manage state instead of InProc
I dont think option (2) will go down too well, so initially I think option
(3) is the quick and easy answer as option (4) may have its own inherent
problems.
I've heard of strange things happening when state is not managed inproc.
(not saying it cant work ), but no point in adding extra risk if I can avoid
it.
Thanks for your help.
"Mark Rae" <ma**@markNOSPA Mrae.comwrote in message
news:%2******** ********@TK2MSF TNGP02.phx.gbl. ..
"Goofy" <me@mine.comwro te in message
news:u5******** ******@TK2MSFTN GP03.phx.gbl...
>It would be tidier though if you could kill the old sessions to preserve resources. Its perhaps not so important in small applications, but when there are hundreds of users on line, this could lead to problems.
Several options, then:
1) Make the sessions as small as possible
2) Reduce the Session.Timeout from its default of 20 minutes
3) Add more memory to your webserver
4) Use SQL Server to manage state instead of InProc
"Goofy" <me@mine.comwro te in message
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
I dont think option (2) will go down too well,
You might be pleasantly surprised, in fact...
so initially I think option (3) is the quick and easy answer
Well, it's certainly quick and easy - if you are maxed out on your server's
RAM capacity, you could always look at throwing more hardware at the problem
by getting more servers and using NLBS...
as option (4) may have its own inherent problems.
Such as...?
I've heard of strange things happening when state is not managed inproc.
Like what...?
(not saying it cant work )
Well, obviously it *can* work otherwise it wouldn't be there... This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Fred |
last post by:
There is a setting in INIT.ORA that has the unintended side-effect of
making sure the ALTER SYSTEM KILL SESSION command has immediate affect.
Without this setting, I've seen some instances where the session reports
as being KILLED in V$SESSION but is not physically removed until the
instance is bounced. Does anyone remember this value offhand?
|
by: yabba |
last post by:
w2k server
as webadmin i have occasion to kill a user session and couse them to login
again. I have the sessionID saved in a file.
is there a way to kill the user session without disturbing others?
tia
|
by: Fabrice |
last post by:
Hello,
I 'would like to build a system (based on database, not SqlServer but MySQL)
to permit only one session per user. I'm using a form athentication.
My Solution :
---------------
When a connection is established by a user, I realize an insert in a Table,
named tbLogin with many informations such as idUser, SessionId, Guid, Date,
|
by: HM |
last post by:
Hello !
To kill a session i used KILL -INT <PID>.
This command wasn't successfull. The processus is still here when an
'ps ax' or a 'select * from pg_stat_activity'
Is there an other way to kill this process only because a web server
24/7 use postgres and cannot stop postgresql now.
|
by: drodrig |
last post by:
Hi.
I am trying to close/kill all processes that show visible windows on
Windows XP. So far I've created a script that uses win32gui.EnumWindows
to iterate through all windows, check for which windows are visible,
then send a WM_CLOSE message to the window to request that it closes.
Of course, not all apps want to close nicely. At this point I need to
use something like TerminateProcess to kill the app, but how do I find
the process id...
| |
by: Mangler |
last post by:
I have 2 sessions that get created. One when the user logs in called
"uname" and another called "idrma" when that user choses to begin a
repair request. I know <%session.abandon% will kill both sessions,
how to I only target one?
|
by: Nikky |
last post by:
I m sending a session from 1 form to another form i want to kill that session when i came back to first form how can i do this.
i m using more than one session at a time but i want to kill choosen session.
|
by: mritunjay82 |
last post by:
If any user is deleted from admin section and is still logged in he can keep on doing things on my website that need to be logged in.
I want to kill this users session.
The only possible way I know is to put his userId in db table and check on each page request if user is desired one. If it is, just clear his session. But this is not at all food approach as it is very seldom situation.
Please help with some server level way to kill...
|
by: spectrumdt |
last post by:
Hello.
I am running Fedora Linux and KDE, using the Konsole command line.
When coding Python, I regularly make a bug causing my program to not
terminate. But how do I kill the non-terminating Python interpreter
without killing the entire Konsole?
The default way of killing the current process on the command line is
Ctrl+C, but that doesn't work with Python. Neither do the "terminate
|
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: 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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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: 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: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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...
| |