System.Web.HttpContext.Current.Session.Item - NullReferenceException

I'm running an ASP.NET application on a remote server.  The application has a page (page1.aspx) that creates an instance of a class (class1) that creates an instance of a class (class2) that creates an instance of a class (class3).  Classic n-tier stuff.

When I try to access a session variable using the System.Web.HttpContext.Current.Session.Item("itemx") method I get a "[NullReferenceException: Object reference not set to an instance of an object.]".
The aspx page and all the classes are part of the same ASP.NET project. I cannot recreate this error using a similar project structure.
Any help/hints would be appreciated.
Thanks, Phil Graham
-1
philg_ASPNETForum
8/12/2003 10:05:45 AM
asp.net.state-management 8807 articles. 0 followers. Follow

0 Replies
1260 Views

Similar Articles

[PageSpeed] 2

Reply:

Similar Artilces:

System.Web.HttpContext.Current.Session
I am currently using System.Web.HttpContext.Current.Session["myobject"]; To retrive a certain variable within my business layer.  I have now put a web services layer in between my web UI and my business layer so these Session variables are no longer useful. What is the best way to retrieve these vars? Retreive them from your UI layer and pass them to your web service as parameters.Community Coder In your web service, you can retrieve the session ID out of the UI layer.....something like thisstring session_id = Request.QueryString["Session_id"].ToString(...

Difference between System.Web.Caching.Cache and System.Web.HttpContext.Current.Cache
Hi,   Can any one help me to understand the difference between the web caching and teh  httpcontext caching. Which is best to use. Does any one have the some good links on this topic. Thanks in advance for all ur time. System.Web.Caching.Cache: this is the implementation of .NET caching.System.Web.HttpContext.Current.Cache: this is the instance of that implementation, that lives in the application domain.You should use System.Web.HttpContext.Current.Cache for storing your data.More info:How to: Add Items to the Cache:http://msdn.microsoft.com/en-us/library/18c1wd61(VS.80)....

System.Web.HttpContext.Current.Session in class file producing Object Reference not set.
Hi all, I am trying to set a var like so in my class        Public Sub New()            If System.Web.HttpContext.Current.Session("Order") Is Nothing Then                System.Web.HttpContext.Current.Session("Order") = "1"            End If        End SubHowever this is returning a "Object reference not set to an instance of an object"...

Difference between Session.Contents, Context.Items, and HttpContext.Current.Session etc...
I am trying to understand a difference between following in ASP .net 2.0 state management.  Can some one explain please.  Does one metter from the other when you are doing Server.Transfer() etc... Session.Contents["ITEM1"] = "abc"; Context.Items["ITEM1"] = "abc";and lastly: HttpContext.Current.Session["ITEM1"] = "abc"; Hi spatemp,  spatemp:Context.Items["ITEM1"] = "abc"; HttpContext.Current.Session["ITEM1"] = "abc"; Context.Items set or get the key/value collection ...

HttpContext.Current.Items.Item("Var") / Session("Var")??
Hi I populated State table in following two items and they both worked fine. 1. HttpContext.Current.Items.Item("datasetOfStateTable") 2. Session("datasetOfStateTable") Does this mean that "HttpContext.Current.Items.Item("datasetOfStateTable")" is an equivalent of "Session("datasetOfStateTable")"? What are the pros and cons of both? Where should we use so that they can offer best performance? Please advice. Thanks Pankaj The difference is their lifetime. The HttpContext/HttpRequest items collection is ...

System.Web.HttpContext.Current.ApplicationInstance
I have a web service that is defined in my global asax to be available to the whole application: Public ReadOnly Property CommonServiceClass() As CommonServiceSoap Get CommonServiceClass = commonService End Get End Property and then in the rest of the application (which are .asmx web services) I access it via: Dim global As Global = CType(System.Web.HttpContext.Current.ApplicationInstance, Global) global.commonserviceclass.methodtocall The problem is that I moved a lot of code from my asmx.vb files into other cla...

System.Web.HttpContext.Current.Server.MapPath
System.Web.HttpContext.Current.Server.MapPath is used to provide a mapPath for a webform class.  What is the equivalent if your class is for a winform. I'm not sure why you would need an analgous method for Server.MapPath() in Windows Forms. Server.MapPath() is designed to return a physical file name from a virtual path so that APIs which work with physical paths, such as those for loading files, can be used from web code, where the physical path isn't going to be known.If you simply want to know where your Windows Form code is running use System.WindowsForms.Application.ExecutablePat...

Caching with System.Web.HttpContext.Current.Cache
Hi, I have a 3 tier app. I populate a drop down list in my presentation layer using a datareader. The drop down is bound to the following code in the data layer.public static SqlDataReader GetAuthors() {SqlConnection connGetAppNo = null; try {connGetAuth = ConnectionProvider.GetConnection();  if (connGetAuth != null) { SqlDataReader drGetAuth = (SqlDataReader)System.Web.HttpContext.Current.Cache["GetAuth"];if (drGetAuth == null) { SqlCommand cmdGetAuth = new SqlCommand("GetAuth", connGetAuth);cmdGetAuth.CommandType = CommandType.StoredProcedure; drGetA...

Session state management using web services.
 Hi all ,i am working of a hospital management system which we desided to develop using atlas frame work. we have created the application main to sections using atlas script call back architecture. we are using scripts to pack the user entered data to the web service and in that web service we are entering the data in to the database.all this happening with out a post back of the page.now comes the problem. we are not being able to handle the user session properties. we came to know that we cant access session variables in web services. we are in a trap now. how we can manage the sessio...

Help for Visual web dev isolate system.web.mail to system.net.mail
Hi all,  I'm new user to visual web developer express software. Laterly i found this application isolate quite some of the component namespace, like system.web.mail to net.mail. I not well understand how system.net.mail functional?? Does it act same as system.web.mail?? My coding below: change system.web.mail to system.net.mail which causing a lot error... *****Can anybody correct me or advise me how to make this code work in system.net.mail?????? <%@import Namespace="System.net.Mail" %> <script runat="server">    Public FromAddress As String = "" .......

System.Web.HttpContext.Current.User.Identity.Name
i use C# and ASP.NET, so i am doing a test: on page load: Label1.Text = System.Web.HttpContext.Current.User.Identity.Name; and i get nothing thanks kids :) http://www.reichslieder.com/0249_wwi_russian_soldier.jpg Is your web site set to "Allow anonymous"? If so, are you doing any kind of authentication such as Forms authentication? yep...forms auth what i want to do is get user name and compare it to the name in the cookie, if both compare then i let them go on, if it doesn't compare i will let the user register (sql server entry) and then s...

Managing session state across multiple web applications
Is there any way to maintain session state across multiple ASP.NET web applications ? Have a look at this post: http://forums.asp.net/t/954238.aspx , read user sschack's reply. I believe this user is Stephen Schackow, one of the program manager on ASP.NET team. In one of his books, Professional ASP.NET 2.0 Security, Membership and Role Management, there is whole chapter on session management, invaluable information, that will solidify your knowledge on ASP.NET session state.Jack Yang.NET Developer...

System.Web.HttpContext.Current.Request.PathInfo Not returning an adress
I have a strange problem, im using a Page Class with some thing like this: Imports Microsoft.VisualBasicPublic Class PageClass Inherits System.Web.UI.Page Protected Overrides Sub OnLoad(ByVal e As EventArgs) Response.Write(System.Web.HttpContext.Current.Request.PathInfo)MyBase.OnLoad(e) End SubOn my developing machine (Visual Studio 2008, Vista) its runs fine. I get some thing like: /controls/_expo/ printed on my screen. But when i publish the website to the server (Running Windows Server 2008), i dont get anything from my OnLoad. Anyone, please help me out ?! Hi niklasnson, I have...

Difference from System.Web and System.Net
Excuse me, could anyone explain me a concept of the differnce between System.Web and System.Net? And how to use two of these? Thank you, Aom I believe you are on the wrong mailing list! On 2014-06-26, 5:49 AM, Alonze wrote: > Excuse me, could anyone explain me a concept of the differnce between System.Web and System.Net? > And how to use two of these? > > > Thank you, > > Aom > > > _______________________________________________ > dev-platform mailing list > dev-platform@lists.mozilla.org > https://lists.mozilla.org/listinfo/dev-...

Key and Data Management System using .Net web service
 Hi all, I am a total beginner and desperately in need for your help.  I want to create a Key and Data Management  System using .Net web service but have no idea where to start.   What would be the easiest way to do this?  First, how do I setup IIS and ASP.NET?  I used window Vista and followed this when installing IIS 7.0:  To Install:Download the ZIP file and extract the MSI.  Install the MSIRun notepad as Administrator(do this by right-clicking your notepad shortcut and chosing "Run as Administrator")Open %systemdir%\system32\ine...

Web resources about - System.Web.HttpContext.Current.Session.Item - NullReferenceException - asp.net.state-management

multi-device-hybrid-apps
Q&A for professional and enthusiast programmers

Pointer (computer programming) - Wikipedia, the free encyclopedia
This article is written like a manual or guidebook . Please help rewrite this article from a descriptive, neutral point of view , and remove ...

OPAC Discovery
Switch Language To switch to a different language, select from the following list: English French Spanish Italian British Bulgarian Galician ...

News
Delivering NSW rugby fans the latest news, rugby match fixtures & results, video and rugby statistics for the Shute Shield - NSW Premier Rugby ...

Object reference not set to an instance of an object.
Line 9: Layout = "/Areas/News/Views/Shared/NewsLayout.cshtml";Line 10: PageSettings pageSettings = new PageSettings(ABSOneDomain.Helpers.Ref ...

AdDuplex Windows Phone SDK v.2.8.0.4 Released
... have released an updated version of our SDK for Windows Phone XAML based apps (both for WP7.x and WP8 apps). This update mitigates a rare N ...

Windows Phone - AgileBits Forum
Support forum for 1Password for Windows Phone

Article index by subject
... Go to BTplc.com Go to investor centre Text A A A HeaderTextBox Article Index By date By subject Previous printed publications System.NullReferenceException: ...

Job Search Canada - Employment Opportunities Site - Find & Post Jobs Online
Find and post jobs online - search for jobs across Canada, read the latest employment news articles, get career tips and advice at Canada's top ...

Don’t assign a field from many methods
... assign it. Does the field type is a value or a reference type? In the case of a reference type, such situation might reveal a potential Nu ...

Resources last updated: 1/19/2016 5:26:58 PM