944,056 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Marked Solved
  • Views: 9580
  • ASP.NET RSS
Mar 1st, 2007
0

Session in app_code

Expand Post »
i have a class in app_code folder which implements the Ihttphandler Interface.so when the execution enter in the Processrequest method i have to use the session variables created on login page.but there is no such Session Object present there.

on login page i hav created session like this

session("userid")=dr("user")

i hav context which is object of Httpcontext class which is a input parameter in the Processrequest method.

with this context object i have wrote

dim user as string =context.Session.Item("userid")

but this will genearte an error

An exception of type 'System.NullReferenceException' occurred in App_Code.7qviugdw.dll but was not handled in user code
Additional information: Object reference not set to an instance of an object.


how can access session inside this class?
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
kapil.goyal is offline Offline
47 posts
since Jan 2007
Mar 6th, 2008
0

Re: Session in app_code

i have a class in app_code folder which implements the Ihttphandler Interface.so when the execution enter in the Processrequest method i have to use the session variables created on login page.but there is no such Session Object present there.

on login page i hav created session like this

session("userid")=dr("user")

i hav context which is object of Httpcontext class which is a input parameter in the Processrequest method.

with this context object i have wrote

dim user as string =context.Session.Item("userid")

but this will genearte an error

An exception of type 'System.NullReferenceException' occurred in App_Code.7qviugdw.dll but was not handled in user code
Additional information: Object reference not set to an instance of an object.


how can access session inside this class?
You can use HttpContext.Current.Session() Instead.
Last edited by Hausen; Mar 6th, 2008 at 2:38 am.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Hausen is offline Offline
1 posts
since Mar 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: SQL Server Question...
Next Thread in ASP.NET Forum Timeline: WEB Services





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC