Multiple instances of ASP.NET application - Best practice

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
 
P

Patrice

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).
 
I

Iain

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;

?
 
P

Patrice

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...
 
I

Iain

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.
 

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

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top