saifullah khan

saifullah khan

  • NA
  • 335
  • 300.9k

session

Jun 24 2011 6:27 AM
i have created a webpage. i want that before entering in that page session should check that what is the role of user that is admin or user. i have put the following condition.

protected void Page_Load(object sender, EventArgs e)
{
if (Session["Role"].ToString = "User")
{
Response.Redirect("Dataentry.aspx");
}
else
Response.Redirect("ControlPannel.aspx");
}

But it gives me the following error:

The name 'Session' does not exist in the current context

i have also used Session("Role") but gives the same error.
please tell me what is the problem.

Answers (4)