Click here to Skip to main content
13,148,573 members (63,319 online)
Rate this:
Please Sign up or sign in to vote.
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 11-Jan-13 6:55am
HashamAhmad 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)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.170924.2 | Last Updated 11 Jan 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100