Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 25th, 2007, 03:02 PM
Authorized User
 
Join Date: Apr 2007
Location: , , .
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default Ask IIS for a GUID?

Hi gang,

This seems like it should be trivial, but I cannot find reference material for it.

I need to get the GUID assigned to a user when he/she accesses a web page. I was under the impression (not sure why) that IIS generated one for each session. Is that true?

I am looking for the defined 32-character id (block of 8, three blocks of 4, block of 12).

I know I could make one, but I need to make sure it is GLOBALLY unique, hence the use of the Guid.

Thanks for any input, even if it is an alternate solution.

Cheers,

Chris
 
Old April 25th, 2007, 03:08 PM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

IIS doesn't hand out IDs; it's ASP or ASP.NET that does that. However, unique as the ASP.NET Session ID may look, I don't think it's guaranteed to be unique.

Creating a Guid is simple. In .NET you can do this:

Guid myGuid = Guid.NewGuid(); // C#

Dim myGuid As Guid = Guid.NewGuid() ' VB

In SQL Server, you can use SELECT NewId()

In all cases, you get a globally unique ID.

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
 
Old April 25th, 2007, 03:25 PM
Authorized User
 
Join Date: Apr 2007
Location: , , .
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks, Imar. I just found an article about that.

My misconceptions lead me astray more often than I would like...

Cheers,

Chris




Similar Threads
Thread Thread Starter Forum Replies Last Post
GUID cdhansen BOOK: Beginning Visual Basic 2005 Databases ISBN: 978-0-7645-8894-5 1 October 21st, 2006 04:56 AM
guid generator in xslt? jkmyoung XSLT 1 November 13th, 2004 06:34 AM
generating two different GUID shaileshmark General .NET 5 August 1st, 2004 01:25 PM
Creating a GUID xgbnow Visual C++ 1 May 6th, 2004 11:10 AM
Dynamic GUID? Klavs Pedersen Visual C++ 1 October 15th, 2003 12:33 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.