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. General Programming
  3. C#
  4. cookies

cookies

Scheduled Pinned Locked Moved C#
question
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.
  • H Offline
    H Offline
    hotthoughtguy
    wrote on last edited by
    #1

    protected void btnAdd_Click(object sender, EventArgs e) { Response.Cookies["message"].Value = txtCookieValue.Text; Response.Cookies["message"].Expires = DateTime.Now.AddDays(1); btnAdd.Text = "done"; if (Response.Cookies["message"] != null) Button1.Text = "null"; else Button1.Text = Response.Cookies["message"].Value; } Button1.text = "null" always. can any one tell me why?

    P P 2 Replies Last reply
    0
    • H hotthoughtguy

      protected void btnAdd_Click(object sender, EventArgs e) { Response.Cookies["message"].Value = txtCookieValue.Text; Response.Cookies["message"].Expires = DateTime.Now.AddDays(1); btnAdd.Text = "done"; if (Response.Cookies["message"] != null) Button1.Text = "null"; else Button1.Text = Response.Cookies["message"].Value; } Button1.text = "null" always. can any one tell me why?

      P Offline
      P Offline
      PSK_
      wrote on last edited by
      #2

      hotthoughtguy wrote:

      protected void btnAdd_Click(object sender, EventArgs e) { Response.Cookies["message"].Value = txtCookieValue.Text; Response.Cookies["message"].Expires = DateTime.Now.AddDays(1); btnAdd.Text = "done"; **if (Response.Cookies["message"] != null)**Button1.Text = "null"; else Button1.Text = Response.Cookies["message"].Value; }

      It should be

      protected void btnAdd_Click(object sender, EventArgs e)
      {

      Response.Cookies["message"].Value = txtCookieValue.Text;
      Response.Cookies["message"].Expires = DateTime.Now.AddDays(1);
      btnAdd.Text = "done";
      if (Response.Cookies["message"] == null)
      Button1.Text = "null";
      else
      Button1.Text = Response.Cookies["message"].Value;
      }

      Regards, Prakash Kalakoti

      H 1 Reply Last reply
      0
      • H hotthoughtguy

        protected void btnAdd_Click(object sender, EventArgs e) { Response.Cookies["message"].Value = txtCookieValue.Text; Response.Cookies["message"].Expires = DateTime.Now.AddDays(1); btnAdd.Text = "done"; if (Response.Cookies["message"] != null) Button1.Text = "null"; else Button1.Text = Response.Cookies["message"].Value; } Button1.text = "null" always. can any one tell me why?

        P Offline
        P Offline
        padmanabhan N
        wrote on last edited by
        #3

        sessionState cookieless="true" ....add this line in web.congif

        Padmanabhan My Articles: Articles[^] My latest Article: Word Automation[^]

        1 Reply Last reply
        0
        • P PSK_

          hotthoughtguy wrote:

          protected void btnAdd_Click(object sender, EventArgs e) { Response.Cookies["message"].Value = txtCookieValue.Text; Response.Cookies["message"].Expires = DateTime.Now.AddDays(1); btnAdd.Text = "done"; **if (Response.Cookies["message"] != null)**Button1.Text = "null"; else Button1.Text = Response.Cookies["message"].Value; }

          It should be

          protected void btnAdd_Click(object sender, EventArgs e)
          {

          Response.Cookies["message"].Value = txtCookieValue.Text;
          Response.Cookies["message"].Expires = DateTime.Now.AddDays(1);
          btnAdd.Text = "done";
          if (Response.Cookies["message"] == null)
          Button1.Text = "null";
          else
          Button1.Text = Response.Cookies["message"].Value;
          }

          Regards, Prakash Kalakoti

          H Offline
          H Offline
          hotthoughtguy
          wrote on last edited by
          #4

          hahahaha what a silly mistake i was making well thanks bro

          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