Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Login Control in Visual Studio 2005

Login Control in Visual Studio 2005

Scheduled Pinned Locked Moved ASP.NET
csharpvisual-studioquestion
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Pranav Thakur
    wrote on last edited by
    #1

    Hi, Please any one explain me in detail how can I make use of "Remember me next time" option for Login Control. Thanks.

    A J 2 Replies Last reply
    0
    • P Pranav Thakur

      Hi, Please any one explain me in detail how can I make use of "Remember me next time" option for Login Control. Thanks.

      A Offline
      A Offline
      Abhijit Jana
      wrote on last edited by
      #2

      use Cookies For That

      Best Regards ----------------- Abhijit Jana "Success is Journey it's not a destination"

      P 1 Reply Last reply
      0
      • P Pranav Thakur

        Hi, Please any one explain me in detail how can I make use of "Remember me next time" option for Login Control. Thanks.

        J Offline
        J Offline
        J a a n s
        wrote on last edited by
        #3

        Yes Google[^] can!

        *jaans

        1 Reply Last reply
        0
        • A Abhijit Jana

          use Cookies For That

          Best Regards ----------------- Abhijit Jana "Success is Journey it's not a destination"

          P Offline
          P Offline
          Pranav Thakur
          wrote on last edited by
          #4

          I have written some code.But its incompleate. Please explain me in detail how to go ahead from here. protected void Login1_Authenticate(object sender, AuthenticateEventArgs e) { if (this.Login1.RememberMeSet) { //Check if the browser support cookies if ((Request.Browser.Cookies)) { //Check if the cookie with name PBLOGIN exist on user's machine if ((Request.Cookies["PBLOGIN"] == null)) { //Create a cookie with expiry of 30 days Response.Cookies["PBLOGIN"].Expires = DateTime.Now.AddDays(30); //Write username to the cookie Response.Cookies["PBLOGIN"].Values["UNAME"] = this.Login1.UserName.ToString(); //Write password to the cookie Response.Cookies["PBLOGIN"].Values["UPASS"] = this.Login1.Password.ToString(); } //If the cookie already exist then wirte the user name and password on the cookie else { Response.Cookies["PBLOGIN"].Values["UNAME"] = this.Login1.UserName.ToString(); Response.Cookies["PBLOGIN"].Values["UPASS"] = this.Login1.Password.ToString(); } } } }

          A 1 Reply Last reply
          0
          • P Pranav Thakur

            I have written some code.But its incompleate. Please explain me in detail how to go ahead from here. protected void Login1_Authenticate(object sender, AuthenticateEventArgs e) { if (this.Login1.RememberMeSet) { //Check if the browser support cookies if ((Request.Browser.Cookies)) { //Check if the cookie with name PBLOGIN exist on user's machine if ((Request.Cookies["PBLOGIN"] == null)) { //Create a cookie with expiry of 30 days Response.Cookies["PBLOGIN"].Expires = DateTime.Now.AddDays(30); //Write username to the cookie Response.Cookies["PBLOGIN"].Values["UNAME"] = this.Login1.UserName.ToString(); //Write password to the cookie Response.Cookies["PBLOGIN"].Values["UPASS"] = this.Login1.Password.ToString(); } //If the cookie already exist then wirte the user name and password on the cookie else { Response.Cookies["PBLOGIN"].Values["UNAME"] = this.Login1.UserName.ToString(); Response.Cookies["PBLOGIN"].Values["UPASS"] = this.Login1.Password.ToString(); } } } }

            A Offline
            A Offline
            Abhijit Jana
            wrote on last edited by
            #5

            // Function to remember the login details in a cookie. function RememberMe() { // Get the login data. var username = document.getElementById('txtUsername').value; var password = document.getElementById('txtPassword').value; // Remember the cookie for 100 days from now. var date = new Date(); date.setTime( date.getTime() + (8640000000) ); // Set the cookie. document.cookie = "Username=" + username + "; expires=" + date.toGMTString() + "; path=/"; document.cookie = "Password=" + password + "; expires=" + date.toGMTString() + "; path=/"; } ' Read and set the username and password from the cookies. If IsNothing(Request.Cookies("Username")) = False Then txtUserName.Text = Request.Cookies("Username").Value If IsNothing(Request.Cookies("Password")) = False Then txtPassword.Text = Request.Cookies("Password").Value Source : http://www.geekpedia.com/tutorial81_Handling-cookies-in-ASP-.NET.html[^]

            Best Regards ----------------- Abhijit Jana "Success is Journey it's not a destination"

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups