473,569 Members | 2,698 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 1468
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.c om> wrote in message
news:11******** **************@ i40g2000cwc.goo glegroups.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
4667
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 session. I also read on the site that when using $_SESSION, you shouldn't use session_unset, but instead should use unset() to accomplish the 2nd of...
3
18460
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 is where a form is printed using : <input type="button" name="Button" value="Print Order" onClick="window.print();"> or when the order form is...
3
2013
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
1623
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 do is know when a session is no longer needed, for example, when a user leaves the site or closes the browser. I thought that...
7
3344
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 <% If Request.QueryString("login")= "logout" Then Application.Contents.RemoveAll()
4
2693
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
28212
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 developer needs to know how to use. This article explains the basics of PHP Sessions. Assumptions: Basic PHP knowledge is required (variables, arrays...
3
2271
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 these structs. A typical usage case will be as ff (note the code below is Pseudocode and WILL NOT compile) //example structs (I have left out the...
41
1855
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
7697
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, 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...
0
7612
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...
1
7672
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...
0
7968
tracyyun
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...
1
5512
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2113
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
1
1212
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
937
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.