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. remember me feature in asp.net 1.1

remember me feature in asp.net 1.1

Scheduled Pinned Locked Moved ASP.NET
csharpasp-nettutorial
3 Posts 2 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
    deepalititi
    wrote on last edited by
    #1

    if anyone knows how to implement remember me feature in asp.net 1.1 then plz provide some idea of it.

    K 1 Reply Last reply
    0
    • D deepalititi

      if anyone knows how to implement remember me feature in asp.net 1.1 then plz provide some idea of it.

      K Offline
      K Offline
      kumarjammula
      wrote on last edited by
      #2

      Hi, this code can help. This is code for 2.0 login control u replace login1.username by ur textboxcontrol.text and by this code it will create cookie in ur local system and below code u place in ur pageload This will work fine.... CheckBox chkBox = (CheckBox)Login1.FindControl("RememberMe"); if (chkBox.Checked==true) { HttpCookie myCookie = new HttpCookie("myCookie"); //Instance the new cookie Response.Cookies.Remove("myCookie"); //Remove previous cookie Response.Cookies.Add(myCookie); //Create the new cookie myCookie.Values.Add("user", this.Login1.UserName); //Add the username field to the cookie DateTime deathDate = DateTime.Now.AddDays(1); //Days of life Response.Cookies["myCookie"].Expires = deathDate; //Assign the life period myCookie.Values.Add("pass", this.Login1.Password); } Getting after Cookie created if (Request.Cookies["myCookie"] != null) //Cookie Exists?? { HttpCookie cookie = Request.Cookies.Get("myCookie"); string user = cookie.Values["user"].ToString(); if (user != "") { Login1.UserName = user; //Write the username onto login username textbox } }

      came out of hardwork

      D 1 Reply Last reply
      0
      • K kumarjammula

        Hi, this code can help. This is code for 2.0 login control u replace login1.username by ur textboxcontrol.text and by this code it will create cookie in ur local system and below code u place in ur pageload This will work fine.... CheckBox chkBox = (CheckBox)Login1.FindControl("RememberMe"); if (chkBox.Checked==true) { HttpCookie myCookie = new HttpCookie("myCookie"); //Instance the new cookie Response.Cookies.Remove("myCookie"); //Remove previous cookie Response.Cookies.Add(myCookie); //Create the new cookie myCookie.Values.Add("user", this.Login1.UserName); //Add the username field to the cookie DateTime deathDate = DateTime.Now.AddDays(1); //Days of life Response.Cookies["myCookie"].Expires = deathDate; //Assign the life period myCookie.Values.Add("pass", this.Login1.Password); } Getting after Cookie created if (Request.Cookies["myCookie"] != null) //Cookie Exists?? { HttpCookie cookie = Request.Cookies.Get("myCookie"); string user = cookie.Values["user"].ToString(); if (user != "") { Login1.UserName = user; //Write the username onto login username textbox } }

        came out of hardwork

        D Offline
        D Offline
        deepalititi
        wrote on last edited by
        #3

        thanks for the code. But i have to know how to redirect to the page which comes after login page directly. when there is cookie available at page load event then how to redirect to the next page from the login page

        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