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. Form Authentication cookie

Form Authentication cookie

Scheduled Pinned Locked Moved ASP.NET
questioncsharpasp-netsecurityhelp
2 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.
  • S Offline
    S Offline
    sandeep kumar pundhir
    wrote on last edited by
    #1

    Hi, i am using Form Authentication in my asp.net appication. It creates a persistent cookie named Cookie1 in cookies folder at my system. I want to change/set the Name of this cookie to Cookie2 on the click of a button from page.How can i do that ? (Q: Does form authentication always created persistent cookie, how can i change it so that when i close the browser , the coookie also goes off ?) Alternatly, if i can create a new form authentication cookie at the same place with the name Cookie2. i am using following code.But cannot see my cookie2 in the folder protected void LinkButton2_Click(object sender, EventArgs e) { FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, "username", DateTime.Now, DateTime.Now.AddMinutes(30), true, FormsAuthentication.FormsCookiePath); string encryptedTicket = FormsAuthentication.Encrypt(ticket); HttpCookie authCookie = new HttpCookie("cookie2", encryptedTicket); authCookie.Expires = System.DateTime.Now.AddMinutes(30); authCookie.Secure = true; Response.Cookies.Add(authCookie); } Any code support will be of great help. Thx

    T 1 Reply Last reply
    0
    • S sandeep kumar pundhir

      Hi, i am using Form Authentication in my asp.net appication. It creates a persistent cookie named Cookie1 in cookies folder at my system. I want to change/set the Name of this cookie to Cookie2 on the click of a button from page.How can i do that ? (Q: Does form authentication always created persistent cookie, how can i change it so that when i close the browser , the coookie also goes off ?) Alternatly, if i can create a new form authentication cookie at the same place with the name Cookie2. i am using following code.But cannot see my cookie2 in the folder protected void LinkButton2_Click(object sender, EventArgs e) { FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, "username", DateTime.Now, DateTime.Now.AddMinutes(30), true, FormsAuthentication.FormsCookiePath); string encryptedTicket = FormsAuthentication.Encrypt(ticket); HttpCookie authCookie = new HttpCookie("cookie2", encryptedTicket); authCookie.Expires = System.DateTime.Now.AddMinutes(30); authCookie.Secure = true; Response.Cookies.Add(authCookie); } Any code support will be of great help. Thx

      T Offline
      T Offline
      T EDY
      wrote on last edited by
      #2

      i already post a message for u in Web Development forums Hope it can help u Regards, Tomi

      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