I've designed a admin page. At First the user want to enter their user name once it's done code will check for the user name in table if the username is there it will send otp to respective login. In my case from otp page I'm trying to access admin view from browser. For example my otp page name is otp.aspx from this page without entering the otp I've changed the admin page like localhost:admin.aspx I want to prevent the user to navigating without entering otp. I've passed the session value even though the page is navigating. Any help thanks in advance.
OTP PAGE CODE :
protected void Page_Load(object sender, EventArgs e)
{
lblOTP.Text = Session["vcode"].ToString();
}
protected void btnOTP_Click(object sender, EventArgs e)
{
if (lblOTP.Text == txtOTP.Text)
{
Session["qq"] = txtusername.Text;
Session["ra"] = txtOTP.Text;
Response.Redirect("ownerupdate.aspx");
}
}
ADMIN PAGE CODE GETTING SESSION VALUE:
protected void Page_Load(object sender, EventArgs e)
{
if (Session["ra"] == null)
{
// If session is null, redirect to default page
Response.Redirect("index.aspx", false);
}
if (!this.IsPostBack)
{
if (!IsPostBack)
{
this.PopulateDropdown();
}
}
}