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. cookies : how to write page_load to cookies

cookies : how to write page_load to cookies

Scheduled Pinned Locked Moved ASP.NET
comhelptutorial
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.
  • K Offline
    K Offline
    kinsella_john
    wrote on last edited by
    #1

    i am attempting to write the cookies for a landing page. i have used the following code to analyse the presence of cookies, but dont know how to write the cookie for the page loading. Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load If Request.Cookies("Landing") Is Nothing Then 'if the name cookie does not exist ask user to enter name Response.Redirect("landing.aspx") Else 'if cookies already exist then show landing page Response.Redirect("tMN_index.aspx") End If this seems to work in terms of directing to the landing page.. just need the cookie help.... i basically want the landing page to appear if the cookie isnt present, and then the landing page to generate the cookie if not present. thank you

    John Michael Kinsella kinsellajohn@hotmail.com

    M 1 Reply Last reply
    0
    • K kinsella_john

      i am attempting to write the cookies for a landing page. i have used the following code to analyse the presence of cookies, but dont know how to write the cookie for the page loading. Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load If Request.Cookies("Landing") Is Nothing Then 'if the name cookie does not exist ask user to enter name Response.Redirect("landing.aspx") Else 'if cookies already exist then show landing page Response.Redirect("tMN_index.aspx") End If this seems to work in terms of directing to the landing page.. just need the cookie help.... i basically want the landing page to appear if the cookie isnt present, and then the landing page to generate the cookie if not present. thank you

      John Michael Kinsella kinsellajohn@hotmail.com

      M Offline
      M Offline
      Mariusz Wojcik
      wrote on last edited by
      #2

      As I understand, you want to know how to create a new cookie. Below is a simple example how to do that. Depends on your needs, set appropriate properties of System.Web.HttpCookie object. Basically you simply add a new cookie object into Response.Cookies collection and that's all. Using Respose.Cookies class you can also remove or change any cookie your application creates. Dim cookie As System.Web.HttpCookie Dim cookieName As String Dim cookieValue As String cookie = New System.Web.HttpCookie(cookieName, cookieValue) Response.Cookies.Add(cookie)

      -- Mariusz 'mAv' Wójcik master e-software engineer

      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