473,387 Members | 1,876 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,387 software developers and data experts.

Reference Current Session!

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
Nov 19 '05 #1
1 958
Adam Knight wrote:
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

Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Pkpatel | last post by:
Hi, I keep getting this error every time I try to load crystalreportviewer on a webform with a dataset. Here is the error: -------------------------------------------------------- Server...
7
by: kon george | last post by:
Can somebody assist. I build this code on a dev laptop and copied across the entire code to a Windows 2003 server with 1.1 framework. It is basic ASP.NE T that uses web service for SQL Server...
5
by: simon | last post by:
I get an error message: Exception Details: System.NullReferenceException: Object reference not set to an instance of an object. I get an error in line: If Session("user") Is Nothing Then.... ...
3
by: Don | last post by:
I have a module where I have common routines. When I want to use it I place the following on top of the sompage.aspx.v imports Mycode.CWPS.CWPSCod I then call a routine that I want to use. ...
5
by: Matt | last post by:
Hi all, I'm having a very strange problem. The third line in the following code gives me a null reference exception when used in an ASP.Net web page. The code is called on the click of a...
2
by: George Durzi | last post by:
Consider these three projects: - ProjectWeb (my web application) - Facade (my class library, does data access, etc.) - Library (a library of classes I reuse in applications) ProjectWeb...
0
by: =?Utf-8?B?SkhhbGV5?= | last post by:
Our system is: IIS Server: dual Intel Xeon 2.80 GHz, 4 GB Ram Windows Server 2003 SP2 IIS 6.0 SQL Server: dual Intel Xeon 2.80 GHz, 4 GB Ram (separate server) Windows Server 2003 SP2 SQL...
5
by: MattB | last post by:
I'm relatively familiar with asp.net and vb.net and have been working in the environment for several years. I've dealt with null reference errors before and generally know how to code around them...
5
by: _Who | last post by:
I have a sub that I need to use in the .master and the context aspx.vb files. How can I do that without reproducing it in each of those files. Can I reference it if it is in the .master or is...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
0
marktang
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,...
0
Oralloy
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,...
0
jinu1996
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 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.