G
Guest
What properties on a HttpCookie give invalid information when you read it
from the Request object?
For example if you run this code, I believe the domain, expires, and
HttpOnly do not tell the truth.
protected string CookieList_Get()
{
HttpCookie cookie;
StringBuilder sb = new StringBuilder();
try
{
sb.Append("<p><b> Cookie List</b></p>");
for ( int i = 0; i <=
HttpContext.Current.Request.Cookies.Count-1; i++)
{
cookie = HttpContext.Current.Request.Cookies;
sb.Append("<b>Cookie: " + cookie.Name + " </b> " +
System.Convert.ToString(i + 1) + " of " +
System.Convert.ToString(HttpContext.Current.Request.Cookies.Count) + "<br
/>");
sb.Append(" Expires: " + cookie.Expires + "<br />");
sb.Append(" Secure: " + cookie.Secure + "<br />");
sb.Append(" Domain: " + cookie.Domain + "<br />");
sb.Append(" Path: " + cookie.Path + "<br />");
sb.Append(" HttpOnly: " + cookie.HttpOnly + "<br />");
if (cookie.HasKeys)
{
for (int j = 0; j < cookie.Values.Count-1; j++)
sb.Append(" Value(" +
System.Convert.ToString(j) + "): " + cookie.Values.GetKey(j) + ": " +
cookie.Values[j] + "<br />");
}
else
{
sb.Append(" Value: " + cookie.Value + "<br />");
}
}
}
catch (Exception ex)
{
return ex.Message;
}
return sb.ToString();
}
from the Request object?
For example if you run this code, I believe the domain, expires, and
HttpOnly do not tell the truth.
protected string CookieList_Get()
{
HttpCookie cookie;
StringBuilder sb = new StringBuilder();
try
{
sb.Append("<p><b> Cookie List</b></p>");
for ( int i = 0; i <=
HttpContext.Current.Request.Cookies.Count-1; i++)
{
cookie = HttpContext.Current.Request.Cookies;
sb.Append("<b>Cookie: " + cookie.Name + " </b> " +
System.Convert.ToString(i + 1) + " of " +
System.Convert.ToString(HttpContext.Current.Request.Cookies.Count) + "<br
/>");
sb.Append(" Expires: " + cookie.Expires + "<br />");
sb.Append(" Secure: " + cookie.Secure + "<br />");
sb.Append(" Domain: " + cookie.Domain + "<br />");
sb.Append(" Path: " + cookie.Path + "<br />");
sb.Append(" HttpOnly: " + cookie.HttpOnly + "<br />");
if (cookie.HasKeys)
{
for (int j = 0; j < cookie.Values.Count-1; j++)
sb.Append(" Value(" +
System.Convert.ToString(j) + "): " + cookie.Values.GetKey(j) + ": " +
cookie.Values[j] + "<br />");
}
else
{
sb.Append(" Value: " + cookie.Value + "<br />");
}
}
}
catch (Exception ex)
{
return ex.Message;
}
return sb.ToString();
}