2
Answers

How to use Varibles in code behind for C# web

suresh Shewale

suresh Shewale

10y
563
1
I want to know whether to use static variables in C# website where multiple user access the website across same page.
Or to use view state/hidden field
or to use properties
Or to use simple variables
Which is most preferable and standard way to use ?
Thanks in advance.........
Answers (2)
0
suresh Shewale

suresh Shewale

NA 112 8.5k 10y
Thanks ,I dont want to share values among users .Means every user should preserve his own value.For that we now set these static variables defined inside methods on Page.Whether this is right or not?
0
Mohan Subramanian

Mohan Subramanian

NA 24 13.1k 10y
Hi,
its depends upon your requirement. you can use static variable to show page to all users or you can use Cache for showing same page for all users.