session variable error asp.net

Cristal

New Member
Suppose i have 2 pages 'A' and 'B'. i set a session variable in 'A', that is checked in page_load function in page 'B' using:\[code\] if (!string.IsNullOrEmpty(Session["x"].ToString())) { }\[/code\]and the appropriate actions are performed based on the value of that session variable but if I open page 'B' first , it gives the error:\[code\] Object reference not set to an instance of an object.\[/code\]How do i set the instance of this object beforehand itself?
 
Back
Top