By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,276 Members | 1,218 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,276 IT Pros & Developers. It's quick & easy.

Session variables conflict

P: n/a
Hi,

Here's my problem. I'm working on a site where customers can buy
tickets for events. Let's take the example where in webform1.aspx, the
customer enter all its personal information. Then when he clicks a
button to register and go to the next step, i enter the personal
information in the database and redirect to let's say webform2.aspx.

Once in webform2, if the user go back to webform1 with his browser's
back button and clicks on the button in webform1 again, this will add
another record in the database.

To fix this problem i just added the new customer id in a Session
variable when the user registers for the first time. So if he goes
back then clicks on the button again, i will update his profile
instead of creating a new, duplicated record.

However in the admin part of the site, the administrator can create
multiple new registrations at the same time, in different browser
windows. Different windows yes, but still the same session! Which
means that the customer id stored in Session is being replaced.

I'm looking for a way to store the id without conflicts if there are
different windows open for the same session. Is there a way to
retrieve a unique id for each browser window? Ex:

Session[UniqueIdOfWindow.ToString() + "CustomerId"] = 5;
Or any other way to share a value between pages. Hidden fields or
query strings won't work, since this problem happens when the user
clicks on the back button of his browser, so there is no way to send
hidden fields values or parameters in the url. Any idea would be
appreciated. Thanks!

Matt
Nov 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Matt wrote:
Once in webform2, if the user go back to webform1 with his browser's
back button and clicks on the button in webform1 again, this will add
another record in the database.


Change the code to search for the given client record and update it if
found, insert it if not.

--
There are 10 kinds of people. Those who understand binary and those who
don't.

http://code.acadx.com
Nov 17 '05 #2

P: n/a
Good idea, but won't work if the user go back to correct some
information. Ex: his name or phone number

If he corrects his phone number, and then i do a search using his
phone number, it won't find the record in the database, so i would
create a new record. Thanks for trying!
On Wed, 13 Aug 2003 18:06:41 -0500, "Frank Oquendo" <fr****@acadx.com>
wrote:
Matt wrote:
Once in webform2, if the user go back to webform1 with his browser's
back button and clicks on the button in webform1 again, this will add
another record in the database.


Change the code to search for the given client record and update it if
found, insert it if not.


Nov 17 '05 #3

P: n/a
What you need to do is determine what makes a user unique. Is it a Name,
Name / Phone number combination etc. If a combination of all fields make a
user unique, always insert a new record like you are doing. Whatever
happens at step two probably generates some databse entries. You can have a
process that runs daily / weekly that clears out users that "never made it
to step two"

OR

When the user clicks "register" on webform1, check to see if a user like
this exists yet. If it exists, update the user, grab the UserID, and move
on to step 2. If ti does not exists, create the user, grab the UserID, and
move to step two.

Michael

"Matt" <me***@rocks.com> wrote in message
news:ir********************************@4ax.com...
Hi,

Here's my problem. I'm working on a site where customers can buy
tickets for events. Let's take the example where in webform1.aspx, the
customer enter all its personal information. Then when he clicks a
button to register and go to the next step, i enter the personal
information in the database and redirect to let's say webform2.aspx.

Once in webform2, if the user go back to webform1 with his browser's
back button and clicks on the button in webform1 again, this will add
another record in the database.

To fix this problem i just added the new customer id in a Session
variable when the user registers for the first time. So if he goes
back then clicks on the button again, i will update his profile
instead of creating a new, duplicated record.

However in the admin part of the site, the administrator can create
multiple new registrations at the same time, in different browser
windows. Different windows yes, but still the same session! Which
means that the customer id stored in Session is being replaced.

I'm looking for a way to store the id without conflicts if there are
different windows open for the same session. Is there a way to
retrieve a unique id for each browser window? Ex:

Session[UniqueIdOfWindow.ToString() + "CustomerId"] = 5;
Or any other way to share a value between pages. Hidden fields or
query strings won't work, since this problem happens when the user
clicks on the back button of his browser, so there is no way to send
hidden fields values or parameters in the url. Any idea would be
appreciated. Thanks!

Matt

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.507 / Virus Database: 304 - Release Date: 8/4/2003
Nov 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.