Re: Assigning a serial # to an ASP email form.

by =?iso-8859-1?Q?St=E9phane?= Bergeron <stephberg(at)videotron.ca>

 Date:  Thu, 23 Mar 2000 17:28:36 -0500
 To:  hwg-techniques(at)hwg.org
 References:  network
  todo: View Thread, Original
At 08:01 AM 23/03/00 -0600, you wrote:
>Unfortunately, session IDs are only unique for currently running sessions,
>there's no guarantee that once a session ends that ID won't be used again.
>You might use the session ID, but addend it with the date and time.
>
>-Jeff

This is not exactly true... In fact, Session IDs are guaranteed to be 
unique for the duration of an Application.  Once the computer running the 
server is rebooted or the server itself is stopped or restarted then there 
is a chance that a Session ID string might be reused.  That's why it is 
advised that Session IDs not be used as a database table primary key.  An 
Application in ASP refers to a the collection of Web documents and objects 
defined on the server as virtual directories.  An Application is started as 
soon as a user accesses a document in that virtual directory (usually 
that's a Web site and that virtual directory is the site's root) and only 
ends when the server computer or the server software are stopped or 
restarted.  Sessions represent individual client sessions within an 
Application and Session IDs are guaranteed to be unique within that 
application's duration.

In the case of this poster's request, I don't think using Session IDs would 
be advisable, but not because of the chance an ID might be repeated but 
because Session IDs are usually long unwieldy text strings that mix letters 
and numbers.  It might be a better idea to store a number in a simple text 
file on the server.  That number would be incremented each time a user 
submits the form.  The current number in the text file would be appended to 
the email and then incremented and re-saved over the old file.  A database 
containing a table with an auto number field would also work (and be easier 
to work with than the FileSystemObject) and would make it easy to save that 
user's details in the database at the same time if that information may be 
useful for the site's owner.

HTH!

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA