Multiple instances of ASP.NET application - Best practice

  • Thread starter Thread starter Iain
  • Start date Start date
I

Iain

All,

I have a problem with my application when the user runs multiple
instances of my application.

The problem has been traced to the selected value of a GridView, i'm
passing the value of the selected Gridview row to a string variable but
this is then used by all other open instances of my application.

What's the best practice/solution to dealing with multiple instances of
an application?

Regards
Ian
 
The usual problem is a misuse of static (C#) or shared (VB) variables. Those
variables are shared by the whole application and an ASP.NET application is
a single application used by multiple users...

How is declared the variable that holds this info ? (and if this is static
or shared, change this to an instance variable instead).
 
Patrice said:
The usual problem is a misuse of static (C#) or shared (VB) variables. Those
variables are shared by the whole application and an ASP.NET application is
a single application used by multiple users...

How is declared the variable that holds this info ? (and if this is static
or shared, change this to an instance variable instead).

Thanks for the response.

The variable is declared as a static variable which is causing the
problem, declaration :

static string myvar;

change the above to

string myvar;

?
 
Yes, this is a very common issue. See for example :

http://support.microsoft.com/kb/893666/en-us

The key point to understand here is that an ASP.NET application is a single
application that is used by multiple users. So if you have a value that is
global to your application (that is a class variable rather than an instance
variable), it is the same value for all users...
 
Patrice said:
Yes, this is a very common issue. See for example :

http://support.microsoft.com/kb/893666/en-us

The key point to understand here is that an ASP.NET application is a single
application that is used by multiple users. So if you have a value that is
global to your application (that is a class variable rather than an instance
variable), it is the same value for all users...
Thanks Patrice, that makes it clearer.
 
Back
Top