469,925 Members | 1,475 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,925 developers. It's quick & easy.

Mimic Session object (of ASP.NET) in Winform app

Hello all...

I need to have global data available within the lifetime of my Winform
app, accessible from any objects this application might spring at
runtime.

In ASP.NET, I can just create this holder object, put this object in
(System.Web.SessionState.HttpSessionState)Session object, and whenever
I need to access the global data from virtually any object having
access to the Session object, I just call

((HolderObjectType)Session["TheHolderObject"]).TheData

In Winform, I was hoping that I can rely on
System.Windows.Forms.Application object and put something in it.
Apparently the System.Windows.Forms.Application can't store data like
the System.Web.SessionState.HttpSessionState object.

Is there something obvious that I miss? If not, what is your
recommendation to achieve what I want?

Thanks in advance,

/john
Nov 15 '05 #1
1 2050
What's wrong with creating an internal or public class with static
properties?

Once initialized, these can be simply accessed from any object in your
AppDomain by using the classname followed by the static property name.

Cheers,
Wim Hollebrandse
http://www.wimdows.com
http://www.wimdows.net

"John Indra" <ma******@office.naver.co.id> wrote in message
news:75**************************@posting.google.c om...
Hello all...

I need to have global data available within the lifetime of my Winform
app, accessible from any objects this application might spring at
runtime.

In ASP.NET, I can just create this holder object, put this object in
(System.Web.SessionState.HttpSessionState)Session object, and whenever
I need to access the global data from virtually any object having
access to the Session object, I just call

((HolderObjectType)Session["TheHolderObject"]).TheData

In Winform, I was hoping that I can rely on
System.Windows.Forms.Application object and put something in it.
Apparently the System.Windows.Forms.Application can't store data like
the System.Web.SessionState.HttpSessionState object.

Is there something obvious that I miss? If not, what is your
recommendation to achieve what I want?

Thanks in advance,

/john

Nov 15 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by LL | last post: by
9 posts views Thread by RA | last post: by
2 posts views Thread by roland | last post: by
3 posts views Thread by MrShovel | last post: by
13 posts views Thread by | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.