Hi Everyone,
I have problem, If the session user is not the desired user then redirect to homepage.
In my page load I have written below code but it is not working( No Errors, But unable to login other than the given user name in the page load).
- protected void Page_Load(object sender, EventArgs e)
- {
- if (Session["username"] == null)
- {
- Response.Redirect("Login.aspx");
- }
- Label1.Text = " " + Session["username"];
- else if (Session["username"] != null) ;
- {
- Session["username"] = Label1.Text = "abc";
- Session["username"] = Label1.Text = "xyz";
- }
- Response.Redirect("error.aspx")
Here "abc" & "xyz" are the two users which I dont want to give access to page want to redirect to home page.
Please help me.
Thanks,
Sandeep