ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 8th, 2006, 04:52 AM
imperialx imperialx is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2006
Posts: 558 imperialx User rank is Corporal (100 - 500 Reputation Level)imperialx User rank is Corporal (100 - 500 Reputation Level)imperialx User rank is Corporal (100 - 500 Reputation Level)imperialx User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 23 h 13 m 27 sec
Reputation Power: 10
Clear session

Hi,

When I release session objects I do this
Code:
session("username")=""

So whats the difference when I do this
Code:
set session("username")=nothing
or
session.remove("username")


Isn't I already release it with a null value?

Reply With Quote
  #2  
Old November 8th, 2006, 06:17 AM
degsy degsy is offline
Contributing User
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Nov 2001
Posts: 1,882 degsy User rank is Sergeant (500 - 2000 Reputation Level)degsy User rank is Sergeant (500 - 2000 Reputation Level)degsy User rank is Sergeant (500 - 2000 Reputation Level)degsy User rank is Sergeant (500 - 2000 Reputation Level)degsy User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 5 Days 21 h 19 m 30 sec
Reputation Power: 18
There is a slight different between destroying a session and making it equal to nothing.

If it is equal to nothing then it does exist and use String or Len functions to compare/validate it.

Logically, if you destroy the session then is doesnot exist and you should be able to use IsNull or IsEmpty to compare/validate.

ASP VBScript is pretty lenient on some validation though.


http://www.w3schools.com/asp/met_abandon.asp
http://www.w3schools.com/asp/met_contents_remove.asp

Reply With Quote
  #3  
Old November 8th, 2006, 04:27 PM
alexk13's Avatar
alexk13 alexk13 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Location: Sydney, Australia
Posts: 50 alexk13 User rank is Corporal (100 - 500 Reputation Level)alexk13 User rank is Corporal (100 - 500 Reputation Level)alexk13 User rank is Corporal (100 - 500 Reputation Level)alexk13 User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 6 Days 10 h 43 m 59 sec
Reputation Power: 11
If you want to "destroy" all of your session variables you can also use:
Code:
Session.Abandon


Hope this helps

Alex

Reply With Quote
  #4  
Old November 14th, 2006, 08:29 PM
imperialx imperialx is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2006
Posts: 558 imperialx User rank is Corporal (100 - 500 Reputation Level)imperialx User rank is Corporal (100 - 500 Reputation Level)imperialx User rank is Corporal (100 - 500 Reputation Level)imperialx User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 23 h 13 m 27 sec
Reputation Power: 10
Hello,

I try to Stop IIS and when I Start it again sessions and application values are still there

How do you clear all this objects in IIS? can I clear it in using IIS?

Reply With Quote
  #5  
Old November 14th, 2006, 11:37 PM
chazzuka chazzuka is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2006
Location: Bali - Indonesia
Posts: 28 chazzuka User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 49 m 44 sec
Reputation Power: 0
Send a message via Yahoo to chazzuka
hmm it sounds impossible dude when you restart IIS Then all user define variable will be released except cookies. it make a sense because those all variables exist under the IIS service.

release session,

if you using session("sesname") = "" mean
you assign the session to have empty string value but the session variable still exist in the service.

both set session("sesname")=nothing or session.remove("sesname") are quite same.

session.abandon mean you destroy all session variables in your current service

the best way to find out if the variables is exist or not by using isEmpty not isNull

try these code:

Code:
<%
' I never declare the session("1") but isNull will return false

Response.Write "isEmpty="&isEmpty(Session("1"))&"<br>"
Response.Write "isNull="&isNull(Session("1"))&"<br>"
%>

Reply With Quote
  #6  
Old November 15th, 2006, 12:55 AM
imperialx imperialx is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2006
Posts: 558 imperialx User rank is Corporal (100 - 500 Reputation Level)imperialx User rank is Corporal (100 - 500 Reputation Level)imperialx User rank is Corporal (100 - 500 Reputation Level)imperialx User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 23 h 13 m 27 sec
Reputation Power: 10
Hi chazzuka,

Oh I thought IIS can clear those objects, I guess not. Thanks!

Reply With Quote
  #7  
Old November 15th, 2006, 01:05 AM
chazzuka chazzuka is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2006
Location: Bali - Indonesia
Posts: 28 chazzuka User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 49 m 44 sec
Reputation Power: 0
Send a message via Yahoo to chazzuka
i mean when you stop the web service all the user define variables will be lost except cookies so i think it is impossible when u restart the IIS the the session still remain or maybe cache problem

Reply With Quote
  #8  
Old January 25th, 2007, 09:07 AM
imperialx imperialx is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2006
Posts: 558 imperialx User rank is Corporal (100 - 500 Reputation Level)imperialx User rank is Corporal (100 - 500 Reputation Level)imperialx User rank is Corporal (100 - 500 Reputation Level)imperialx User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 23 h 13 m 27 sec
Reputation Power: 10
Hello,

When I now use the clear session with a value set to nothing, I receive this error

error
Quote:
Error Type:
Session object, ASP 0185 (0x80020003)
A default property was not found for the object.
/logout.asp, line 2



logout.asp
Code:
<%
		session("id")=nothing
		session("username")=nothing
		session("islogin")=nothing	
			
		response.Redirect ("index.asp")
%>

Reply With Quote
  #9  
Old January 25th, 2007, 09:12 AM
Tukaro's Avatar
Tukaro Tukaro is offline
Standing 3 feet to the left.
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jan 2006
Location: USA
Posts: 1,435 Tukaro User rank is First Lieutenant (10000 - 20000 Reputation Level)Tukaro User rank is First Lieutenant (10000 - 20000 Reputation Level)Tukaro User rank is First Lieutenant (10000 - 20000 Reputation Level)Tukaro User rank is First Lieutenant (10000 - 20000 Reputation Level)Tukaro User rank is First Lieutenant (10000 - 20000 Reputation Level)Tukaro User rank is First Lieutenant (10000 - 20000 Reputation Level)Tukaro User rank is First Lieutenant (10000 - 20000 Reputation Level)Tukaro User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Week 5 Days 3 h 49 m 16 sec
Reputation Power: 184
Send a message via AIM to Tukaro Send a message via MSN to Tukaro
It's my understanding that you have to use "Set" when doing that, like "Set session("id") = Nothing". Give that a shot.

Reply With Quote
  #10  
Old January 25th, 2007, 09:55 AM
imperialx imperialx is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2006
Posts: 558 imperialx User rank is Corporal (100 - 500 Reputation Level)imperialx User rank is Corporal (100 - 500 Reputation Level)imperialx User rank is Corporal (100 - 500 Reputation Level)imperialx User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 23 h 13 m 27 sec
Reputation Power: 10
Hi Tukaro,

I have Set it and when I redirect it to another page I receive this error

Quote:
Error Type:
Response object, ASP 0185 (0x80020003)
A default property was not found for the object.
/index.asp


because there is no line number to know where the error is, I think this is where it cause it

index.asp
Code:
.
.
.
<%if isempty(session("islogin")) then%>
.
.
.


what went wrong?

Reply With Quote
  #11  
Old January 25th, 2007, 10:13 AM
imperialx imperialx is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2006
Posts: 558 imperialx User rank is Corporal (100 - 500 Reputation Level)imperialx User rank is Corporal (100 - 500 Reputation Level)imperialx User rank is Corporal (100 - 500 Reputation Level)imperialx User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 23 h 13 m 27 sec
Reputation Power: 10
Hello,

After setting to nothing in LOGOUT.asp from the above code how come I couldn't use this condition?
Code:
<%if isempty(session("islogin")) then
                 response.write "is empty"
             else
                 response.write "empty" <--won't show :(
             end if
%>

Reply With Quote
  #12  
Old February 14th, 2007, 06:46 AM
Munchio Munchio is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2007
Location: UK
Posts: 5 Munchio User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 51 m 42 sec
Reputation Power: 0
Have you tried:

Session("id") = Empty

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > Clear session

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap