DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   ASP.NET (http://www.daniweb.com/forums/forum18.html)
-   -   calling session variable (http://www.daniweb.com/forums/thread42067.html)

vaisakh Mar 28th, 2006 5:22 am
calling session variable
 
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

SergioGP Mar 29th, 2006 12:45 pm
Re: calling session variable
 
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.


All times are GMT -4. The time now is 5:57 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC