Yeah. The thing is, the Session is more for maintaining state across
different pages associated with the same Session. Perhaps the OP could
explain if these pages are sharing a Session - or if they are in different
Sessions (i.e. a second instance in a second browser instance on the same
client - or even two separate browser instances on different machines with
potentially different users). Until the OP gives us a bit more info about
what is required, it's hard to know what the exact nature of the problem is.
Peter
"Peter Bromberg [C# MVP]" <pb*******@yahoo.yabbadabbadoo.comwrote in
message news:5E**********************************@microsof t.com...
This is probably more of an ASP.NET question than a C# language group one.
Typically in ASP.NET you would store your item either in Session,
Application, or Cache state depending on the business scenario or whether
it
is user-specific.
Alternatively, you can put a public static field in your Global class
(global.asax) and you can then use it from any page with:
Global.MyItemName;
Peter
--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net
"ol**@linuxmail.org" wrote:
>Hi,
New to .NET, I was wondering what was the proper way to share a
variable between all the instances of a web page.
I try with a static var, but it does not seem to always work. Why is
that ?
public partial class _Default : System.Web.UI.Page
{
static public string sharedvar;
protected void Page_Load(object sender, EventArgs e)
{
...
thanks