473,666 Members | 1,989 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How Unique is a GUID

Hi,

I'm trying to find out how unique a GUID is?

Basically I have two web applications and I need to pass a couple of
session variables between them using a table in a database. I have set
this up and used a GUID as a key for the table and it all seems to
work fine but I'm a little concerned about the uniqueness of the GUID.

Does anyone know how the GUID is created?
or if it is unique across all applications on a webserver?
Thanks
Davinder

Apr 20 '07 #1
5 9730
Hello Davinder,

http://en.wikipedia.org/wiki/GUID
http://en.wikipedia.org/wiki/Univers...que_Identifier

---
WBR, Michael Nemtsev [.NET/C# MVP].
My blog: http://spaces.live.com/laflour
Team blog: http://devkids.blogspot.com/

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

DBasically I have two web applications and I need to pass a couple of
Dsession variables between them using a table in a database. I have
Dset this up and used a GUID as a key for the table and it all seems
Dto work fine but I'm a little concerned about the uniqueness of the
DGUID.
D>
Apr 20 '07 #2
avh

"Davinder" <da************ *@gmail.comschr eef in bericht
news:11******** **************@ y5g2000hsa.goog legroups.com...
Hi,

I'm trying to find out how unique a GUID is?

Basically I have two web applications and I need to pass a couple of
session variables between them using a table in a database. I have set
this up and used a GUID as a key for the table and it all seems to
work fine but I'm a little concerned about the uniqueness of the GUID.

Does anyone know how the GUID is created?
or if it is unique across all applications on a webserver?
Thanks
Davinder


Hi Davinder,

A GUID is GLOBALLY unique.
Trust me: from the moment on this wouldn't be the case anymore, a lot of
applications will get into trouble.
It contains reference to the unique MAC address of the network adapter +
random bytes + date/time etc ...

On Windows NT servers in the past GUIDs produced consecutively GUIDS (unique
still though), but this has changed in future versions of Windows.

Wim
Apr 20 '07 #3
avh
"Davinder" <da************ *@gmail.comschr eef in bericht
news:11******** **************@ y5g2000hsa.goog legroups.com...
Hi,

I'm trying to find out how unique a GUID is?

Basically I have two web applications and I need to pass a couple of
session variables between them using a table in a database. I have set
this up and used a GUID as a key for the table and it all seems to
work fine but I'm a little concerned about the uniqueness of the GUID.

Does anyone know how the GUID is created?
or if it is unique across all applications on a webserver?
Thanks
Davinder

Since it is GLOBALLY unique, you can't be sure that this GUID will not be
re-used on Mars !,
so you might get into trouble if you are planning to use this for message
exchange with aliens ! :-)
Apr 20 '07 #4

Michael, Wim thanks for your replys, the info is very helpful.

after I had written the message I actually did a quick test and
produced 100,000 GUIDs from my web apps and there were no clashes, so
I guess it should all run without any problems.

Since it is GLOBALLY unique, you can't be sure that this GUID will not be
re-used on Mars !,
so you might get into trouble if you are planning to use this for message
exchange with aliens ! :-)
ahh this may cause a problem in the future then! I was planning on
hosting one of the web apps on mars so aliens could use it, guess I'll
have to come up woth a workaround, oh well :o)

Davinder

Apr 20 '07 #5
You should have read the Wikipedia article. You would have saved yourself
some trouble. The probability of 2 GUIDs being the same is about 1 in a
quintillion.

--
HTH,

Kevin Spencer
Microsoft MVP

Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net

"Davinder" <da************ *@gmail.comwrot e in message
news:11******** **************@ p77g2000hsh.goo glegroups.com.. .
>
Michael, Wim thanks for your replys, the info is very helpful.

after I had written the message I actually did a quick test and
produced 100,000 GUIDs from my web apps and there were no clashes, so
I guess it should all run without any problems.

>Since it is GLOBALLY unique, you can't be sure that this GUID will not be
re-used on Mars !,
so you might get into trouble if you are planning to use this for message
exchange with aliens ! :-)

ahh this may cause a problem in the future then! I was planning on
hosting one of the web apps on mars so aliens could use it, guess I'll
have to come up woth a workaround, oh well :o)

Davinder

Apr 20 '07 #6

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

Similar topics

8
4476
by: Joe Wong | last post by:
Hi, I need to implement a unique number generator that 1 or more processes on same or different machines will make use of it. Is there any library / project available already for this? Thanks in advance, -- Wong
4
15635
by: Louis Frolio | last post by:
Greetings All, I have read many upon many articles here regarding GUID data types and uniqueness. There have been many opinions regarding the effectiveness of GUID's and when they should/should not be used. However, every article strongly implies, if it does not state it outright, that GUID's are always unique. My question is this, what happens if you have a database that uses GUID's and the NIC is changed out on the box? From what I...
6
3058
by: Mullin Yu | last post by:
hi, i have a web service that has file operations on Windows OS, and there may be a file concurrency issue if only one working directory e.g. c:\working therefore, i want to have a unique sub directory for each request so as to get rid of any file concurrency issue, e.g c:\working\unique-identifier1 for Request #1 c:\working\unique-identifier1 for Request #2
4
1655
by: Brett | last post by:
The following is called each time an event is triggered. The generated GUID is the same for 3 of 4 calls. Is there a way to ensure it is different for each call? this.PrintMessage(System.Guid.NewGuid().ToString() + this.MessageImageFileExtension, RootImageFileDirectory + "\\" + DateTime.Today.Month.ToString() + DateTime.Today.Year.ToString() + "\\"); Thanks, Brett
2
4535
by: Chris Dunaway | last post by:
I have a web service which is accessed by a windows forms application. When the application submits a unit of work (a "job"), I want to return a job receipt or tracking number back to the application. My requirements are these: 1. The receipt number must be unique (like a guid is unique) 2. The receipt must be NON sequential. 3. If possible, I'd like it to be 10 to 12 characters long. 4. If possible, I'd like to include only...
14
2700
by: Chris Dunaway | last post by:
I have used Guid's as a unique identifier in data applications. But in a recent project, the length of the Guid's string is proving to be too long. Is there a method for generating a unique string that is less than the length of a Guid? If I were to take the hash of a Guid string, what is the likelyhood that two different Guids would have the same hash? Can anyone offer any other suggestions?
7
2772
by: cj | last post by:
I need to choose a 20 char unique id for transactions handled by my multithreaded program. I can't decide if to use Dim uid As String = Guid.NewGuid.ToString uid = uid.Replace("-", "") uid = uid.Substring(0, 20) or Dim uid as string = Now().Ticks.ToString.PadLeft(20, "0")
16
6914
by: Mark S. | last post by:
I'm a fan of the GUID, but the current project is looking to use a genuinely unique integer. Does the following do that? Math.Abs(System.Guid.NewGuid().GetHashCode()) TIA
6
4345
by: =?Utf-8?B?QWxwaGFwYWdl?= | last post by:
Hello, I want to generate a unique ID for each page of my Asp.Net application. My first step is to generate a new Guid when the page is loaded for the first time and registers, stores this new Guid in a Dictionary which is saved in the ApplicationState, then I add a hidden field to the page __PageID, so I can get this unique ID on other Postbacks. No problem. The problem is about hackers. They can modify my hidden field to another...
0
8448
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8871
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8783
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8552
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8640
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4369
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1776
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.