calling session variable

Please support our ASP.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Mar 2006
Posts: 11
Reputation: vaisakh is an unknown quantity at this point 
Solved Threads: 0
vaisakh vaisakh is offline Offline
Newbie Poster

calling session variable

 
0
  #1
Mar 28th, 2006
when i call the session variable on pageload the following error occur

System.NullReferenceException: Object reference not set to an instance of an object.


the code was

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

religion.SelectedItem.Text = CStr(Session("name"))

Session.Remove("name")
end sub
Reply With Quote Quick reply to this message  
Join Date: Mar 2006
Posts: 8
Reputation: SergioGP is an unknown quantity at this point 
Solved Threads: 0
SergioGP SergioGP is offline Offline
Newbie Poster

Re: calling session variable

 
0
  #2
Mar 29th, 2006
in the Global.asax file at the Session_Start event, initialize your session variable with any value then you can use it latter on your code.
SergioGP

Search your feelings...
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC