Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi friends
i have declared static class
problem occurred when two or more user logged in
suppose:
every user create their own item in the page. my side is when user select item and display it in gridview throgh view state
the gridveiw show double -triple records
because it show all user data that are logged in when they create their own items
the data is mismatching each-other.................
plz..........
solution.
Posted

1 solution

The rule is - don't use static classes.

You need to use instances, and to store information either in cookies or in the Session instead of classes.

The whole idea of Static is that there is only one per application - in ASP.NET that is not a solution you can use, as two users may opr may not share an application, and the application may well be terminated and restarted before one user has finished with it.

In ASP, the application starts when the first user starts to use it, but it can (and often will) be ended at the end of that page load and be reloaded when the user does a post back. You can't store information in a static class and expect it to even be available to the same user!
 
Share this answer
 
Comments
Monjurul Habib 8-May-12 16:37pm    
5!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900