473,396 Members | 1,933 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

New Session?


I would like to discover whether the current Session ID/token is being
used for the first time. I think I need to trap for this in the
Session_Onstart in global.asax but I don't know for sure.

Thanks.
Nov 19 '05 #1
7 1410
They are GUIDs. The likelihood that they would be reused
is extremely rare.

--
2004 and 2005 Microsoft MVP C#
Robbe Morris
http://www.robbemorris.com
http://www.masterado.net

"xenophon" <xe******@online.nospam> wrote in message
news:rf********************************@4ax.com...

I would like to discover whether the current Session ID/token is being
used for the first time. I think I need to trap for this in the
Session_Onstart in global.asax but I don't know for sure.

Thanks.

Nov 19 '05 #2
SessionID's are guaranteed to be unique
from the moment IIS starts until it stops.

There's a small chance that a SessionID might be
repeated if the server is stopped and restarted.

It's a very small chance, statistically speaking, though.

Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"xenophon" <xe******@online.nospam> wrote in message
news:rf********************************@4ax.com...

I would like to discover whether the current Session ID/token is being
used for the first time. I think I need to trap for this in the
Session_Onstart in global.asax but I don't know for sure.

Thanks.

Nov 19 '05 #3
Hi

In load of each page put

if(Session.IsNewSession)
{
///
}

Regards,

Daniel Roth
MCSD.NET

Nov 19 '05 #4

Thanks for the response. In the case of Cookieless Sessions, the token
is in the URI, and if user #1 copy-pastes the URI into an email and
sends it to user #2, then they could both potentially share the same
Session. Bad.

Since I can map a Sesion token to a user account in code, I just need
to know if it's a new one or not and work from there.

Thanks.
On Wed, 18 May 2005 19:36:06 -0400, "Robbe Morris [C# MVP]"
<in**@eggheadcafe.com> wrote:
They are GUIDs. The likelihood that they would be reused
is extremely rare.


Nov 19 '05 #5

Thanks for the response. In the case of Cookieless Sessions, the token
is in the URI, and if user #1 copy-pastes the URI into an email and
sends it to user #2, then they could both potentially share the same
Session. Bad.

Since I can map a Sesion token to a user account in code, I just need
to know if it's a new one or not and work from there.

Thanks.


On Wed, 18 May 2005 20:02:24 -0400, "Juan T. Llibre"
<no***********@nowhere.com> wrote:
SessionID's are guaranteed to be unique
from the moment IIS starts until it stops.

There's a small chance that a SessionID might be
repeated if the server is stopped and restarted.

It's a very small chance, statistically speaking, though.

Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"xenophon" <xe******@online.nospam> wrote in message
news:rf********************************@4ax.com.. .

I would like to discover whether the current Session ID/token is being
used for the first time. I think I need to trap for this in the
Session_Onstart in global.asax but I don't know for sure.

Thanks.


Nov 19 '05 #6

Thanks for the info, I will try to work with that.

On 18 May 2005 19:12:34 -0700, da********@gmail.com wrote:
Hi

In load of each page put

if(Session.IsNewSession)
{
///
}

Regards,

Daniel Roth
MCSD.NET


Nov 19 '05 #7
Hi Xenophon,

As Daniel has mentioned, we can use the HttpSessionState.IsNewSession to
determine whether the session is newly created by the current request.
However, if your actual concern is the problem with using cookieless
session, I'm afraid we haven't any buildin means to detect whether the
comming request client is the reallly the correct user associated with the
SessionState (identify by the sessionid embeded in url). That means if A is
visisting the asp.net web app through the sessionidA and B paste the
sessionidA directly into it's URL, B will also make use of A's
sessionstate. In fact, this is because the serverside hasn't enough
information to distinguish users in cookieless scenario. And if you'd like
to manually detect such condition, you can try mantaining a server loopup
list which record all the sessionid associated with its client user's IP
address. Anyway, even using cookieless Session, it's stil very rare that
sessionID is reused since everyuser will have own randomly generated
sessionid.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 19 '05 #8

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

Similar topics

2
by: Damien | last post by:
Hi to all, I'm currently re-designing our intranet : nice and lean CSS2, cleaned-up PHP 4.3.7, better-normalized MySQL ;o). So I've started using the $_SESSION variable instead of register_globals...
1
by: mudge | last post by:
I'm running PHP Version 4.3.10. I'm trying to make it so that when a person logs in using a user name and password that their session is valid and continues for a few months so they don't have to...
6
by: Al Jones | last post by:
This is a repost form the vbscript newgroup - if this isn't the appropriate group would you point me toward one that is. Basically, I seem to be losing session data part way though preparing an...
5
by: Abhilash.k.m | last post by:
This is regarding the session management using Out of proc session management(SQL SERVER). Among the samples below which one is better to set the session? 1. There are 20 session...
0
by: joseph conrad | last post by:
Hi, I tried to implement my own session handler in order to keep control on the process the drawback I foun it is not creating and storing in my cookie the PHPSESSID variable anymore. reading te...
14
by: aroraamit81 | last post by:
Hi, I am facing a trouble. I have some Session variables in my code and somehow my session variables are getting mixed up with other users. For example User A has access to 10 companies and...
7
by: aroraamit81 | last post by:
Well Guys, Here is a very strange trouble. When more than one users request tto same page at the same time then our session gets conflicted. Moreover I printed my SessionID, strangely but true I...
0
by: TRB_NV | last post by:
I'd been using an Access database based shopping cart, but wanted to change it so that it would use session variables. I have a form that's submitted to a page called addtocart.asp that contains...
1
by: Santosh | last post by:
Dear All i am writting a code sending mail with attachement. i am writting code for sending mail in one page and code for attaching a file in the next page. aftet attaching a file i am taking...
5
by: lyealain | last post by:
<% If Session("username") = "" Then Response.Redirect("/CLS/Login.asp") End If Dim conn Dim connectstr Dim db_name, db_username, db_userpassword Dim db_server Dim res
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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...

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.