SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: Setting Cookies

  1. #1
    SitePoint Zealot
    Join Date
    Jul 2006
    Posts
    114
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Setting Cookies

    I am trying to set a cookie on the host machine and I am not able to. There are no errors, the cookie just never appears.Below is the code i am using. Does anyone see why the cookie is not getting to the computer?

    Code:
    HttpCookie cookie = new HttpCookie("Cookie Name");
    cookie.Value = "Cookie Value";
    Response.Cookies.Add(cookie);
    Thanks in advance for any help given...

  2. #2
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,235
    Mentioned
    154 Post(s)
    Tagged
    0 Thread(s)
    I'd start with http://msdn.microsoft.com/en-us/libr...(v=vs.71).aspx

    Try setting the Expires and Path properties on the Cookie too.

  3. #3
    SitePoint Zealot
    Join Date
    Jul 2006
    Posts
    114
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am extremely new to cookies... is there a default path?

  4. #4
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,235
    Mentioned
    154 Post(s)
    Tagged
    0 Thread(s)
    Default would be "/" and it will apply to your entire site, if you want it to only apply to your application "/VirtualDirectoryName"

  5. #5
    SitePoint Zealot
    Join Date
    Jul 2006
    Posts
    114
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by cpradio View Post
    Default would be "/" and it will apply to your entire site, if you want it to only apply to your application "/VirtualDirectoryName"
    I am sorry for not getting back sooner on this. That completely solved the issue. Thanks for the Help


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •