0

Hi

I am trying to view my cookie using VS 2008 having 2 textbox 1 Button 1 hyperlink.
But failed... While excuting the code it is displaying the output as -
The Vishal cookie contains: Deb
Cookie Path is /

But where actually physical cookie is stored I can't able to find. Here is my Code -

protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString["cookie"] != null)
        {
            ReadCookie();
        }
    }

    protected void ReadCookie()
    {
        //Get the cookie name the user entered
        String strCookieName = Request.QueryString["cookie"].ToString();

        //Grab the cookie
        HttpCookie cookie = Request.Cookies[strCookieName];

        //Check to make sure the cookie exists
        if (cookie == null)
        {
            lblCookie.Text = "Cookie not found. <br><hr>";
        }
        else
        {
            //Write the cookie value
            String strCookieValue = cookie.Value.ToString();
            String cookiePath = Request.Cookies[strCookieName].Path;
            lblCookie.Text = "The " + strCookieName + " cookie contains: <b>" + strCookieValue + "</b><br> Cookie Path is <b>" + cookiePath + "</b><hr>";
        }
    }
3
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by aspproject
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.