473,383 Members | 1,877 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

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 2153
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: VijayShankar | last post by:
Can u be more specific on your question Anyway its not like Session variables are available for sometime and not available for sometime. When your session starts it is very much available...
5
by: LL | last post by:
Hi, Where is the best place to check the session's object, if it's null, then redirect the user to login page? put into every page's load event? Thanks.
9
by: RA | last post by:
Hi Please review and let me know if I am correct: 1) My understanding from reading http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag/html/ diforwc-ch05.asp is that...
3
by: Diffident | last post by:
Hello All, I want to display all the name-value pairs of the session object....how can I print them out? i.e., suppose once a user logs in I set a session variable login time Session = "2pm" and...
2
by: roland | last post by:
When is the session object created and by which class,httpruntime or httpapplication or sessionstateModule? Thanks
3
by: MrShovel | last post by:
I'm new to this ASP.NET caper and have the following questions. I have a TestObject that contains about 50 fields of data and 3 member procedures. Below is a simplified explanation of what I do....
13
by: | last post by:
Simple question, I think... I'm storing an object in the Session object. In the code behind I read that object: trx = CType(Session("Transaction"), BOCSTransaction) If I change any...
2
by: jyanmin.fang | last post by:
Hi, In my current project, I need to embed an .NET winform usercontrol in the aspx page (via <Objecttag). This winform usercontrol has an event called DoEvent (void DoEvent()). This winform...
8
by: Andy B | last post by:
Is there a way to refer to things in Session object without calling Session itself?
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.