Reference Current Session!

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
 
D

Damien

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,161
Latest member
GertrudeMa
Top