InterUser Interference in .Net Web Apps

  • Thread starter Thread starter fripper
  • Start date Start date
F

fripper

I have a very basic question for which I cannot find a straightforward
answer in the .Net help files. I have a VB .Net web app that at one point
brings up a form (call it Form A) on which the user can enter a user ID
number and a password. Assuming the password is OK I then save the ID in a
global variable which is declared in a module. After viewing this form
(possibly taking some minutes to do so) the user can click on a button which
brings up another form (Form B) and using the ID saved in the global
variable some data relevant to this user is displayed. Now, my question is
what happens if a second user comes in and enters his/her ID number and
password in Form A and goes on to Form B while the first user is still
perusing Form A. When the first user finally goes to Form B will the global
variable still contain his/her ID and not that of the second user? I guess
that what this comes down to is does each user have a separate instance of
the program on the server ... in order to guarantee that one user cannot
affect another? I would think this could be very inefficient. What
principle is at work here? If someone can direct me to a discussion that
talks about this sort of thing I would greatly appreciate it.

Thanks very much.
 
Fripper,

A webapplication is stateless. That means that all information is destroyed
when you show the form again to the user. (Normally when all events are
done).

There are 5 possibilities to save your information:
-on an offline medium as a disk
-in a shared class (which means that it belongs to all active users at that
moment)
-in the cache (almost the same as the shared class)
-in a viewstate (which sends the information with your application every
time to and from the user)
-in a session(which keeps the information special for that user and uses by
instance information from the cookie to identify the user, (it can also be
used cookieless))

In you sample is in my opinion mostly used the session.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iissdk/iis/ref_vbom_seso.asp

I hope this helps?

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top