NCA
NCA

Reputation: 820

Is there any issue in making the properties as static in c# (in case of multiple access)

I am developing a Web Application that allows multiple user access on it.

And in the code behind I am using a property in which i am saving some personal details of the user.

My question is, if I made those properties as static will be there any conflict in data saving in the property when multiple user doing the same thing.

Upvotes: 2

Views: 233

Answers (3)

Sudhakar Tillapudi
Sudhakar Tillapudi

Reputation: 26209

static memebers are maintained only one copy which is common for all the users who see it, hence it's not good to use when you wnat to maintain it for multiple users.

Upvotes: 0

Mrinal Saurabh
Mrinal Saurabh

Reputation: 978

There will be issues if multiple people are using simultaneously and if he app is deployed.

Upvotes: 2

gzaxx
gzaxx

Reputation: 17600

Do not do that. Static values are shared between user sessions so you would override those values for each different user.

Use Session or Cookies to store data for specific user.

Upvotes: 7

Related Questions