I am writing some library routines to use in my asp.net pages. They need to
access my session variables, but I don't know what namespaces/libraries to
access to make it work. Asp.net already does that for you.
How do I access Session variables from my objects?
What refererence (using...) do I need as well as what .dll do I need in my
make file?
Thanks,
Tom 4 4155
Tom,
You can use the HttpContext class. If you use the static Current
property on the HttpContext class, it will return your current HttpContext.
You can then use the Session property on the HttpContext to access the
current session.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"tshad" <ts**********@ftsolutions.com> wrote in message
news:e5**************@TK2MSFTNGP09.phx.gbl... I am writing some library routines to use in my asp.net pages. They need to access my session variables, but I don't know what namespaces/libraries to access to make it work. Asp.net already does that for you.
How do I access Session variables from my objects?
What refererence (using...) do I need as well as what .dll do I need in my make file?
Thanks,
Tom
string whatever = (string) this.Context.Session["whatever"];
--
Derek Davis dd******@gmail.com
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:%2****************@TK2MSFTNGP10.phx.gbl... Tom,
You can use the HttpContext class. If you use the static Current property on the HttpContext class, it will return your current HttpContext. You can then use the Session property on the HttpContext to access the current session.
Hope this helps.
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard.caspershouse.com
"tshad" <ts**********@ftsolutions.com> wrote in message news:e5**************@TK2MSFTNGP09.phx.gbl...I am writing some library routines to use in my asp.net pages. They need to access my session variables, but I don't know what namespaces/libraries to access to make it work. Asp.net already does that for you.
How do I access Session variables from my objects?
What refererence (using...) do I need as well as what .dll do I need in my make file?
Thanks,
Tom
So in my Imports clause would I need:
imports System.Web.HttpContext
I also saw Imports System.Web.SessionState
If I put in the "imports System.Web.HttpContext", would I then do:
string whatever = (string) this.Session["whatever"];
Also, what .dll would I need in my make file - /r:system.web.dll and
/r:system.dll ?
Thanks,
Tom
"carion1" <dd******@gmail.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl... string whatever = (string) this.Context.Session["whatever"];
--
Derek Davis dd******@gmail.com
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in message news:%2****************@TK2MSFTNGP10.phx.gbl... Tom,
You can use the HttpContext class. If you use the static Current property on the HttpContext class, it will return your current HttpContext. You can then use the Session property on the HttpContext to access the current session.
Hope this helps.
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard.caspershouse.com
"tshad" <ts**********@ftsolutions.com> wrote in message news:e5**************@TK2MSFTNGP09.phx.gbl...I am writing some library routines to use in my asp.net pages. They need to access my session variables, but I don't know what namespaces/libraries to access to make it work. Asp.net already does that for you.
How do I access Session variables from my objects?
What refererence (using...) do I need as well as what .dll do I need in my make file?
Thanks,
Tom
system.web will do. One the namespace is available, the code will compile.
Otherwise it won't.
--
Regards,
Alvin Bruney [MVP ASP.NET]
[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @ www.lulu.com/owc
Forth-coming VSTO.NET - Wrox/Wiley 2006
-------------------------------------------------------
"tshad" <ts**********@ftsolutions.com> wrote in message
news:Oq**************@tk2msftngp13.phx.gbl... So in my Imports clause would I need:
imports System.Web.HttpContext
I also saw Imports System.Web.SessionState
If I put in the "imports System.Web.HttpContext", would I then do:
string whatever = (string) this.Session["whatever"];
Also, what .dll would I need in my make file - /r:system.web.dll and /r:system.dll ?
Thanks,
Tom
"carion1" <dd******@gmail.com> wrote in message news:%2****************@TK2MSFTNGP12.phx.gbl... string whatever = (string) this.Context.Session["whatever"];
--
Derek Davis dd******@gmail.com
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in message news:%2****************@TK2MSFTNGP10.phx.gbl... Tom,
You can use the HttpContext class. If you use the static Current property on the HttpContext class, it will return your current HttpContext. You can then use the Session property on the HttpContext
to access the current session.
Hope this helps.
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard.caspershouse.com
"tshad" <ts**********@ftsolutions.com> wrote in message news:e5**************@TK2MSFTNGP09.phx.gbl... I am writing some library routines to use in my asp.net pages. They
needto access my session variables, but I don't know what namespaces/libraries to access to make it work. Asp.net already does that for you.
How do I access Session variables from my objects?
What refererence (using...) do I need as well as what .dll do I need
in my make file?
Thanks,
Tom
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Al Jones |
last post by:
This is a repost form the vbscript newgroup - if this isn't the appropriate
group would you point me toward one that is.
Basically, I seem to be losing session data part way though preparing an...
|
by: Lina Manjarres |
last post by:
Hello,
I have a session variable in a login page. Then I go to a form page where I
uses the ProfileID and the UserID. Then I go to a result page where I would
like to use the UserID as a filter,...
|
by: PJ |
last post by:
A particular page seems to be having issues with correctly setting Session
variables. I am setting a couple of session variables on the Page_Unload
event. While stepping through code, the...
|
by: Harry Simpson |
last post by:
I've come from the old ASP camp where session variables were not used. When
i started using ASP.NET in 2001, I started using them again because it was
ok from what I'd read.
I've been merrily...
|
by: tshad |
last post by:
I have been using the default session state (InProc) and have found that I
have been loosing my information after a period of time (normally 20
minutes).
Is there anyway to find out how much...
|
by: Alan Wang |
last post by:
Hi there,
Once my application gets complicated and complicated. I found it's really
hard to keep track of Session value I am using in my asp.net application. I
am just wondering if anyone have...
|
by: Phillip N Rounds |
last post by:
I'm writing a user control which has two states: Active & InActive. I
additionally am required that there to be only one active control per page,
and all logic has to be contained within the...
|
by: BillE |
last post by:
When a user opens a new IE browser window using File-New-Window the
integrity of an application which relies on session state is COMPLETELY
undermined. Anyone who overlooks the fact that...
|
by: BillE |
last post by:
Some ASP.NET applications use Session Variables extensively to maintain
state.
These should be re-written to use viewstate, hidden fields, querystring,
etc. instead.
This is because if a user...
|
by: MrHelpMe |
last post by:
Hello again all,
I've finished my whole application and now I don't like the whole
session variables that I am using. I have a form, user fills in info
clicks submit and using CDOSYSMail an...
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |