Click here to Skip to main content
15,895,142 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
I m using the following method to open a page in new tab for ex:- one.aspx.

HTML
ScriptManager.RegisterStartupScript(this, this.GetType(), "Open", "window.open('" + pageurl + "','_newtab','width=1300,height=660');", true);


The page loads, but when i click on a button on one.aspx which redirects me to another page for ex:- Two.aspx it gives me exception on following line of redirected page i.e... Three.aspx on page load

C#
 protected void Page_Load(object sender, EventArgs e)
        {
              string usertype = Session["usertype"].ToString();
        }

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

why Session["usertype"] becomes null?.
Please help me out....
Thanks in advance....
Posted
Updated 1-May-14 9:03am
v2
Comments
Kornfeld Eliyahu Peter 30-Apr-14 10:10am    
Where you set Session["usertype"]'s value?
ZurdoDev 30-Apr-14 10:27am    
I have had this happen before, only in IE, using window.open. I can't recall if I was able to fix it but you may try googling IE window.open session. I seem to recall it was just an IE issue.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900