You must Sign In to post a response.
  • Category: .NET

    How to avoid opening same url link in browser in asp.net/javascript/jquery?

    I have below scenario

    1)Customer login to my website,
    2)then he opened new page and added information on that.
    3)Before saving the information of that page, he copied the URL and paste on another tab of same browser and enter the information.
    4)again he come back to first tab and save the data, we are using session to save the data, so it is conflicted with another tab.

    What i want is to prevent user to open same URL in different tab.

    We have tried with Hidden field <asp:HiddenField runat="server" ID="hfId" value="" /> to solve the problem and it is working, but we don't know its right or wrong?, Please suggest.

    Like bank websites, If we tried to copy URL after logged in into different tabs then it's session expired.

    Please give us direction.
  • #762317
    Hi

    You can try this session statement management

    server side


    //Login Page assign your login details this
    Session["UserName"] = TxtUserName.Text;
    Session["Password"] = TxtPassword.Text;


    // in every page navigate use this code

    if (Session["UserName"] != null)
    {
    Response.Redirect("sales.aspx");
    }
    else
    {
    Response.Write("<script>alert('User Details is Invalid !')</script>");
    }


    Client Side


    <asp:TextBox ID="TxtUserName" runat="server"></asp:TextBox>
    <asp:TextBox ID="TxtPassword" runat="server"></asp:TextBox>


    Name : Dotnet Developer-2015
    Email Id :kumaraspcode2009@gmail.com

    'Not by might nor by power, but by my Spirit,' says the LORD Almighty.


Sign In to post your comments