Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

forcing new session id without closing browser

300 views
Skip to first unread message

Andy G

unread,
Dec 14, 2005, 12:33:18 PM12/14/05
to
Is it possible to force a new session id without the client closing the
browser? I'm using session id in my database and I need a new session id
when a client clicks a certain link. I know I could use my own id in the
database but I was wondering if the the above is possible.

I tried using Session.Abort() and Session.Clear() and used both of them
together and the session id still persists.

Thanks.


Patrice

unread,
Dec 14, 2005, 12:42:39 PM12/14/05
to
Try Session.Abandon.

Don't know for Abort but Clear just clears the session variable...

--

"Andy G" <ajg...@iastate.edu> a écrit dans le message de
news:OEFe7RNA...@TK2MSFTNGP14.phx.gbl...

Dave Johnson

unread,
Dec 14, 2005, 1:10:20 PM12/14/05
to
SURE session.Abandon will work just fine as its the best way to do it,
but you may also want to check somthing like this
Session.Timeout(0.0000000001) will make the user starts a new session
when he makes any interaction with the target page if you ever find it
helpful in your scenario !

session.LCID gets or sets locale identifer for the session, u may want
to check it out too

Sharing makes All the Difference

--
Sent via .NET Newsgroups
http://www.dotnetnewsgroups.com

Andy G

unread,
Dec 14, 2005, 2:19:40 PM12/14/05
to
Sorry I meant to say Abondon in my previous message.

Abondon will not force ASP.NET to create a new session ID. Abondon calls
the Session_End and then the Session_Start, so really it doesn't do much
different than Clear.

I'm going to try using the session.timeout(0.00000001), whatever Dave
suggested below.


"Patrice" <nob...@nowhere.com> wrote in message
news:OqLWJXNA...@TK2MSFTNGP10.phx.gbl...

Dave Johnson

unread,
Dec 14, 2005, 2:28:20 PM12/14/05
to
please keep me updated, thnx

Andy G

unread,
Dec 14, 2005, 5:56:51 PM12/14/05
to
Well I've found some weird stuff and I hope someone can shed some light on
this.

Using the below on the page load will force ASP.NET to get a new Session
variable. I tried to put this same code on a button click event and it
didn't work. I tried it checking the post back and then leaving it out,
didn't make a difference. So the question is, what can Page_Load do/have
access to that a button click event doesn't?

FORCE ASP.NET TO GET A NEW SESSION VARIABLE
If Not IsPostBack Then

Request.Cookies("ASP.NET_SessionId").Expires = Now

End If

Hope some of this helps you guys. Thanks for the help too.

-Andy

"Dave Johnson" <eshar...@gmail.com> wrote in message
news:%23IH1LSO...@TK2MSFTNGP12.phx.gbl...

0 new messages