1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Help with Cookies, Simple Problem

Discussion in 'ASP.NET' started by theNewGuy, May 12, 2009.

  1. theNewGuy

    theNewGuy New Member

    May 12, 2009
    Likes Received:
    Trophy Points:
    Hey if anyone could offer a noob some help here, that would be great!
    I'm new to Web Developer, but I know C# like the back of my hand.
    I've started a website that has two forms, Login.aspx and Default.aspx.
    There is a link on Default.aspx to the Login.aspx, which has a button and a textbox. Clicking the button runs the following code:

    Response.Cookies["name"].Value = TextBox1.Text;
    Button1.Text = Response.Cookies["name"].Value;
    Response.Cookies["name"].Expires = DateTime.Now.AddDays(1);

    I know this code works, because the button's text changes.
    But, on the Default.aspx form the code:

    Label1.Text = Response.Cookies["test"].Value;

    The Label1.Text changes to be blank.
    Is this a problem because I'm running locally?
    Any help would be great!

Share This Page