Hi
initialise the session variable in the Session_Start function of global.aspx
protected void Session_Start(object sender, EventArgs e)
{
Session["UserId"] = "";
}
then inside the master page , check
if (Session["UserId"] == "")
{
Response.Redirect("Login.aspx");
}
else
{
Label1.Text = "Welcome :" + Session["UserId"].ToString();
}
Another solution is that , here i think you are you are using the same master page for Login page also , it is loading before you set session variable thats why getting error , change master page for login page
Thanks