number of users

J

Joe

I've a dotNet web application that works fine when there's only one
user on it. When there's more than one user, it starts to act weird.
I'm not using application variable, just session variable and one
worker process. First I suspect there might be a cross-over session
sharing, but after more tests that doesn't seem to be the case.

The problem as I can tell seem to be one user requesting a page by
clicking on a link while another user requesting a different page also
by clicking on a different link. One user gets to her page while the
other user gets to the wrong page. I'm using Response.Redirect on the
code behind through the link button click event. This doesn't happen at
all when there's only one user on it. I'm running out of idea testing
this. Any suggestions welcome, thanks!
 
G

Guest

Are you using any shared/static methods, properties, etc. Those are not
thread-safe (depending on how you implement and use, of course). So for
example if you stored the URL of next page in a property that was static,
depending on timing of who sets the variable first, who uses it when, the
users could end up seeing 'shared behavior'....

Otherwise we might need to see more code snippets....
 
J

Joe

That was it! One of the variable was declared as Public Shared and I
guess that it acts like an Application variable.

But one question what is the difference between a Public Shared vs
Private Shared
and Public Shared vs Public.

Thank you!
 
B

Bruce Barker

shared means the variable is "shared" between all threads (the variable is
actually part of the class, not the class instance).

public means the variable can be accessed from outside the class.

private means the variable can only be access from within the class.

so

public shared i as int 'can be access from any class or module in
the application
private shared i as int 'can only be accessed from the defining class

in both cases the value is the same from any thread.


-- bruce (sqlwork.com)
 

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
474,432
Messages
2,571,681
Members
48,796
Latest member
Greg L.

Latest Threads

Top