Codebehind Variable State ?

  • Thread starter Thread starter Chris
  • Start date Start date
C

Chris

I'm writing an asp page with C# codebehind. I create a
page level variable. I then alter the variable by
assigning a new value in a private method. When I access
the vairable again from another private method, the
variable has the original value..

Am I missing a scope issue here? Any ideas welcome...

Thanks,
cj
 
Are you doing this on the same request to the server? Or on different
requests (i.e. after a click event).

If it is the latter, then the reason this is so is because HTTP is a
stateless protcol. The page object is recreated every time - it is not as if
the user is getting the same one on every request. If you need values to
persist between requests, you will need to use session or anothe persistence
mechanism.

If this is not the problem, please post your code...
 
Back
Top