473,503 Members | 8,959 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Destroying Sessions

Hi there,

I was testing with sessions lately and wanted to destroy a particular
session.

If I have two sessions at the same page being used.
Session["Test1"] = "testing1";
Session["Test2"] = "testing2";

on using the Session.Abandon(); .... which one of them is destroyed
the Test1 or Test2 ?

Mar 29 '06 #1
6 1461
Varangian wrote:
Hi there,

I was testing with sessions lately and wanted to destroy a particular
session.

If I have two sessions at the same page being used.
Session["Test1"] = "testing1";
Session["Test2"] = "testing2";

on using the Session.Abandon(); .... which one of them is destroyed
the Test1 or Test2 ?

What you are doing in the first two lines is assigning the text to
Session variables not different sessions.

Calling Session.Abandon destroys the entire Session object which holds
all of your session variables.
Mar 29 '06 #2
not different Sessions ?!?
how to set a different session then?

Mar 29 '06 #3
Varangian wrote:
not different Sessions ?!?
how to set a different session then?

You can't. Why would you need a seperate session? You have access to
the Session object which allows you to store an "infinite" amount of
objects inside.
Mar 29 '06 #4
but I need to destroy one of them .. Session.Remove("Test2") for
example will do ?

Mar 29 '06 #5
Varangian wrote:
but I need to destroy one of them .. Session.Remove("Test2") for
example will do ?

Yes
Mar 29 '06 #6
Varangian,

you are confusing "a different session" with "a different session variable".

What you want is not a different session.
What you want is a different session variable.

After you set Session.Remove("Test2"),
Session.Remove("Test2") will work fine to clear it.

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Varangian" <of****@gmail.com> wrote in message
news:11**********************@i40g2000cwc.googlegr oups.com...
but I need to destroy one of them .. Session.Remove("Test2") for
example will do ?

Mar 29 '06 #7

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

Similar topics

3
4664
by: Marcus | last post by:
I know from php.net that when register_globals is turned on, session_start(); session_unset(); session_destroy(); will succeed in unsetting all session variables and then destroying the...
3
18450
by: Pete | last post by:
I have a site which is using sessions to pass data from one page through to the next. The problem that I have is that there are only two places where the session could/should be destroyed. This...
3
2000
by: john | last post by:
Hi I am having a simple login & logout script which are as follow: login.php <?php session_start(); $_SESSION=$_POST; ?> logout.php
2
1618
by: STEPHEN GOODE | last post by:
I have a need to notice when a user leaves a site so I can implement destructors for objects. I know that PHP doesn't supply an object destructor. I can code that myself. What I don't know how to...
7
3341
by: le0 | last post by:
Hello Guys, I have this problem on my page. Im doing my "Logoff" portion, everytime I click "Logoff" then click the Back button in my browser the previous page still appears. Heres my code...
4
2685
by: Olumide | last post by:
Hello - I have two classes A and B as follows: class B{ public: ~B(){ cout << "destroying B" << endl; } }; class A{
3
28192
Atli
by: Atli | last post by:
Introduction: Sessions are one of the simplest and more powerful tools in a web developers arsenal. This tool is invaluable in dynamic web page development and it is one of those things every...
3
2264
by: Bartholomew Simpson | last post by:
I am writing some C++ wrappers around some legacy C ones - more specifically, I am providing ctors, dtors and assignment operators for the C structs. I have a ton of existing C code that uses...
41
1838
by: =?Utf-8?B?VGltIE1hcnNkZW4=?= | last post by:
Hi, I am after suggestions on the best practice declaring and destroying objects. some example code: Private Sub MySub Dim frmMyForm As MyForm Try
0
7207
marktang
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,...
0
7361
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...
1
7015
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...
1
5026
isladogs
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...
0
4693
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...
0
3173
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1523
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 ...
1
749
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
403
bsmnconsultancy
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...

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.