i created a session variable and try to call it on page load on another page the following error occur
: System.NullReferenceException: Object reference not set to an instance of an object.

code is


Session("name")=request(religion_list.selecteditem.text)
server.transfer("profile.aspx")

// then call

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

Session.Remove("name")

plz help me to solve this

man
why u use request object?
u can put the session equals to the religion list directly.

session("sdf") = religion_list.selecteditem.text

i created a session variable and try to call it on page load on another page the following error occur
: System.NullReferenceException: Object reference not set to an instance of an object.

code is


Session("name")=request(religion_list.selecteditem.text)
server.transfer("profile.aspx")

// then call

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

Session.Remove("name")

plz help me to solve this

thats ok but when i call this variable on another page the following error occur
: System.NullReferenceException: Object reference not set to an instance of an object.

how should i create the instance plz


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

Session.Remove("name")

man i think ur problem isnt in the session object but this one religion.selecteditem.Text

this object is it created in ur second page?

coz the error means u havent created an instance of object.

about the session, as i told u.
u can declare and create a one only by the following code:

session("x") = something

sam

This article has been dead for over six months. Start a new discussion instead.