Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm looking for a server-side variable that only lives for the duration of a single request and that gets reset each request, and that is shared between multiple control instances, and that is specific to each user (rather than shared among multiple users).

A static variable persists too long (across multiple requests), a member variable isn't shared among multiple control instances, session persists across multiple requests, and cookies/view state go to the client (I only want it to reside on the server).

I could probably store something in session and reset it in Application_BeginRequest so that it is fresh for each request (and maybe erase it in Application_EndRequest), but I was wondering if there was a more standard way of doing this. How would you create such a variable?
Posted
Comments
[no name] 11-Jan-13 14:03pm    
Global variables for Page Class?? is that what you want?
AspDotNetDev 11-Jan-13 14:16pm    
Not sure what you mean, but any variable (member or static) on the class for a given page would not work because it should be accessible from any control (and controls should have no knowledge of the specific page they are on, because they may reside on many pages). Though, maybe if I put it on the page and passed a delegate to the control so it knows how to get/set the page variable, that'd work. Seems complicated though.

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