declared". Is it not possible to use session variable in module?
Wilson"WilsonSmith" <WSMith1974@.hotmail.com> wrote in message
news:eQh3ZcsaEHA.716@.TK2MSFTNGP11.phx.gbl...
> When I use a session variable in a module, it says "Name session is not
> declared". Is it not possible to use session variable in module?
Here's a quiz for you:
1) In a page, why (and how) is "Session" defined?
2) In what way does that differ from a module?
--
John Saunders
johnwsaundersiii at hotmail
Answers:
1) In a page (or user control), the name "Session" refers to "this.Session"
(or Me.Session in VB.NET). This is the same as Context.Session, which means
this.Context.Session.
2) Anywhere else, "Session" is undefined unless you define it. However, you
can get access to the same value by referring to
System.Web.HttpContext.Current.Session.
When you want to use session but you are not in an aspx page or ascx ( web
user control ), you need to use the code
httpcontext.Current.Session
this will work in module or class.
Thanks,
Tee
"WilsonSmith" <WSMith1974@.hotmail.com> wrote in message
news:eQh3ZcsaEHA.716@.TK2MSFTNGP11.phx.gbl...
> When I use a session variable in a module, it says "Name session is not
> declared". Is it not possible to use session variable in module?
> Wilson
>
>
Thank you so much.
Wilson
"Tee" <thy@.streamyx.com> wrote in message
news:u#GFASuaEHA.3792@.TK2MSFTNGP09.phx.gbl...
> When you want to use session but you are not in an aspx page or ascx ( web
> user control ), you need to use the code
> httpcontext.Current.Session
>
> this will work in module or class.
>
> Thanks,
> Tee
>
>
> "WilsonSmith" <WSMith1974@.hotmail.com> wrote in message
> news:eQh3ZcsaEHA.716@.TK2MSFTNGP11.phx.gbl...
> > When I use a session variable in a module, it says "Name session is not
> > declared". Is it not possible to use session variable in module?
> > Wilson
0 comments:
Post a Comment