Reference Current Session!

  • Thread starter Thread starter Adam Knight
  • Start date Start date
A

Adam Knight

I am trying to gain a reference of the current session object associated
with a user.

On a previous post the following code was provided to help with that.

Session = CType(System.Web.UI.Page) System.Web.HttpContext.Current.Handler

It doesn't look write, at least one parameter may be missing from CType?
I am a little in the dark as to what i need to do anyway, so any
clarification would be appreciated.

As is, it is causing the error: Page is a type in UI and cannot be used in
an expression.

This is new teritory for me, so any help in getting past it would be
appreciated.

Adam
 
Adam said:
I am trying to gain a reference of the current session object associated
with a user.

On a previous post the following code was provided to help with that.

Session = CType(System.Web.UI.Page) System.Web.HttpContext.Current.Handler

It doesn't look write, at least one parameter may be missing from CType?
I am a little in the dark as to what i need to do anyway, so any
clarification would be appreciated.

As is, it is causing the error: Page is a type in UI and cannot be used in
an expression.

This is new teritory for me, so any help in getting past it would be
appreciated.

Adam

Hi Adam,

What's your context? By which I mean, if you're in Visual Studio and
you've added a web form, you can just use the Session object without
any setup. If you're developing a HttpModule or Handler, there's a
couple more steps to take, IIRC. If you're outside of Visual Studio,
you're probably missing a couple of imports which would make life
easier, but it should still be available to you...

Damien
 
Back
Top