Reply
expire the session in vbscript : .NET
Old 07-04-2008, 01:06 PM expire the session in vbscript : .NET
Nazi370's Avatar
Experienced Talker

Posts: 46
Name: Nazirul
Hi ! ...

how do i expire the session created whilst in login? i have google some page but no luck...

this code :

Quote:
If ValidUser.Read() Then
Session("UserType") = "Student"
Session("FullName") = ValidUser.Item("FullName")
Session("MatricNo") = ValidUser.Item("MatricNo")
Session("Course") = ValidUser.Item("Course")
Response.Redirect("Mainpage.aspx")
Else
lblMsg.Text = "Invalid Password/Credential"
lblMsg.Visible = True
End If

thanks...
Nazi370 is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
     
Old 07-05-2008, 04:46 AM Re: expire the session in vbscript : .NET
chrishirst's Avatar
Super Moderator

Posts: 12,758
Location: Blackpool. UK
In no particular order

1/ set them to empty strings.
2/ use session.abandon
3/ use session.contents.removeall()

Take your pick.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 07-06-2008, 01:48 AM Re: expire the session in vbscript : .NET
Nazi370's Avatar
Experienced Talker

Posts: 46
Name: Nazirul
Quote:
1/ set them to empty strings.
Do you mean like : Session("UserType") = "I_am_logoff"

it does not work.. maybe 2 or 3... i will try it..
thanks chris
Nazi370 is offline
Reply With Quote
View Public Profile
 
Old 07-06-2008, 03:53 AM Re: expire the session in vbscript : .NET
chrishirst's Avatar
Super Moderator

Posts: 12,758
Location: Blackpool. UK
empty means empty, ie zero length

= ""
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 07-07-2008, 11:40 PM Re: expire the session in vbscript : .NET
Nazi370's Avatar
Experienced Talker

Posts: 46
Name: Nazirul
sory christ.. it actuall work

expire : Session("UserType") = ""
not expired : Session("UserType") = "I_am_logoff"

do any one know why even i've changed the session type, it still can access the web page? but no when set to empty string?

thanks..
Nazi370 is offline
Reply With Quote
View Public Profile
 
Old 07-08-2008, 02:29 AM Re: expire the session in vbscript : .NET
chrishirst's Avatar
Super Moderator

Posts: 12,758
Location: Blackpool. UK
No idea, It's your code so we have no idea how it works.


do you check for a value or just the session key/value existing?
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 07-10-2008, 03:34 AM Re: expire the session in vbscript : .NET
Nazi370's Avatar
Experienced Talker

Posts: 46
Name: Nazirul
If Trim(Session("StaffType")) = "" Then
Response.Redirect("Invalid.aspx")
End If

If Not Page.IsPostBack Then

End If


this is on page_load ...

it work since when i set the session to "" , then on the page_load will identify it and prohibit to enter the page...

thanks chris
Nazi370 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to expire the session in vbscript : .NET
 

Thread Tools

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.13500 seconds with 13 queries