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 store a value in cookie ???

how to store a value in cookie ???

Scheduled Pinned Locked Moved ASP.NET
questioncsharpasp-nettutorial
4 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.
  • M Offline
    M Offline
    MrMicrosoftvn
    wrote on last edited by
    #1

    I have a login form, and when my users click on the login button to log in my site, i want to create a cookie that store UserID, UserName ... and some information of user. How can i do that in ASP.NET ??? Thus, how can i read the value when cookie is already created ??? Thanks for your answer.

    S T 2 Replies Last reply
    0
    • M MrMicrosoftvn

      I have a login form, and when my users click on the login button to log in my site, i want to create a cookie that store UserID, UserName ... and some information of user. How can i do that in ASP.NET ??? Thus, how can i read the value when cookie is already created ??? Thanks for your answer.

      S Offline
      S Offline
      Sarvesvara BVKS Dasa
      wrote on last edited by
      #2

      Havent used this... but.. u can give a try from the documentation... System.Net.Cookie I was born intelligent
      Education ruined me!.

      1 Reply Last reply
      0
      • M MrMicrosoftvn

        I have a login form, and when my users click on the login button to log in my site, i want to create a cookie that store UserID, UserName ... and some information of user. How can i do that in ASP.NET ??? Thus, how can i read the value when cookie is already created ??? Thanks for your answer.

        T Offline
        T Offline
        T Manjaly
        wrote on last edited by
        #3

        Response.Cookies("UserName").Value = "john" Response.Cookies("UserName").Expires = DateTime.Now.AddMinutes(12) The above code will set the value "john" into a cookie variable called "UserName". This cookie expires after 12 minutes. To read the values from Cookie, userid = Request.Cookies("UserName").Value :zzz:----------------------------------------------------------------------:(( T Manjaly
        C# Tutorials and samples : http://www.dotnetspider.com

        M 1 Reply Last reply
        0
        • T T Manjaly

          Response.Cookies("UserName").Value = "john" Response.Cookies("UserName").Expires = DateTime.Now.AddMinutes(12) The above code will set the value "john" into a cookie variable called "UserName". This cookie expires after 12 minutes. To read the values from Cookie, userid = Request.Cookies("UserName").Value :zzz:----------------------------------------------------------------------:(( T Manjaly
          C# Tutorials and samples : http://www.dotnetspider.com

          M Offline
          M Offline
          MrMicrosoftvn
          wrote on last edited by
          #4

          thanks for your answer :) :)

          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