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. how to remember password in login page .

how to remember password in login page .

Scheduled Pinned Locked Moved ASP.NET
tutorial
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.
  • D Offline
    D Offline
    deepthy p m 0
    wrote on last edited by
    #1

    In the login control, there is a property for saving the password with a check box.i need the code other than the login control.I use seperate textboxes and check box to create login page.If any one know this pls give the code :)

    V C 2 Replies Last reply
    0
    • D deepthy p m 0

      In the login control, there is a property for saving the password with a check box.i need the code other than the login control.I use seperate textboxes and check box to create login page.If any one know this pls give the code :)

      V Offline
      V Offline
      varshavmane
      wrote on last edited by
      #2

      U will have to use cookies for it. Save ur Password in Cookies...

      D 1 Reply Last reply
      0
      • V varshavmane

        U will have to use cookies for it. Save ur Password in Cookies...

        D Offline
        D Offline
        deepthy p m 0
        wrote on last edited by
        #3

        i use the following code to save cookies is this correct. HttpCookie cookie = new HttpCookie("cookiename"); cookie.Values.Add("UserName", TextBox1.Text); cookie.Values.Add("Password", TextBox2.Text); cookie.Expires = DateTime.Now.AddDays(30);

        V 1 Reply Last reply
        0
        • D deepthy p m 0

          i use the following code to save cookies is this correct. HttpCookie cookie = new HttpCookie("cookiename"); cookie.Values.Add("UserName", TextBox1.Text); cookie.Values.Add("Password", TextBox2.Text); cookie.Expires = DateTime.Now.AddDays(30);

          V Offline
          V Offline
          varshavmane
          wrote on last edited by
          #4

          Use this javascript Function: function readCookie(cookies) { var txtuname; var txtpass; var chkRememberLogin; if(document.getElementById('ctl00_CustomLogin_txtUserName') != null) { txtuname = document.getElementById('txtUserName'); txtpass = document.getElementById('txtPassword'); chkRememberLogin = document.getElementById('chkCookie'); } else { txtuname = document.getElementById('txtUserName'); txtpass = document.getElementById('txtPassword'); chkRememberLogin = document.getElementById('chkCookie'); } if (document.cookie.length>0 && txtuname.value.length>0 ) { // check the index of the username that is entered by user in Username text box var c_start=document.cookie.indexOf(txtuname.value); if (c_start!=-1) { var c_end=document.cookie.indexOf(";",c_start); if (c_end==-1) { c_end=document.cookie.length; } var value= unescape(document.cookie.substring(c_start,c_end)); var arr = new Array(10); arr= value.split('='); // if only 0ne equal sign is present that is default one if(arr[0]==txtuname.value && arr.length==2) { txtpass.value=arr[1]; chkRememberLogin.checked = true; } // if the password contain =(equal) signs in it else if(arr[0]==txtuname.value && arr.length > 2) { var pass=arr[1]; for(i=2;i<arr.length;i++)> { pass += arr[i]; } txtpass.value=pass; chkRememberLogin.checked = true; } else { txtpass.value=""; chkRememberLogin.checked = false; } } else { txtpass.value=""; chkRememberLogin.checked = false; } } else { txtpass.value=""; chkRememberLogin.checked = false; } } In Page Load Put this: txtPassword.Attributes.Add("OnFocus", "javascript:readCookie('" & Request.Cookies.ToString() & "');") Above line will get the password in password textbox on focus event. Finally on Login Button Click Event where u have to store password in cookies: If chkRememberMe.Checked Then Dim cookie As New Ht

          1 Reply Last reply
          0
          • D deepthy p m 0

            In the login control, there is a property for saving the password with a check box.i need the code other than the login control.I use seperate textboxes and check box to create login page.If any one know this pls give the code :)

            C Offline
            C Offline
            Christian Graus
            wrote on last edited by
            #5

            I would NEVER save a username/password in a cookie, which a user can read on their PC if they know how. I would store a GUID in a cookie and in your DB, associate that GUID with a login id. This means the client side doesn't have the username/password combo, but you can log them in.

            Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

            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