D
dawson
I started off by trying to use the HttpCapabilitiesBase.Cookies
Property (Note: This property is new in the .NET Framework version 2.0)
however it kept on returning true even when I disabled cookies in both
FireFox and Internet Explorer.
After a bit of googling I found that a lot of people were creating
cookies, then re-reading them; obviously if they could re-read the
cookie then they knew that the client's browser accepts cookies!
Simple. However, after writing a similar class to the ones I viewed
online, I'm still getting true returned, even when I disable cookies in
both FireFox and Internet Explorer.
With FireFox's cookie dialog open, I ran the application with cookies
turned off and indeed, FireFox showed no cookies were stored during the
HTTP request, however my code once again returned true!
When running the application with cookies turned on, FireFox showed one
cookie stored during HTTP request, and the code returned true.
Please advise.
public bool HttpBrowserCookieCheck(HttpRequest Request,
HttpResponse Response)
{
try
{
// Create cookie object
HttpCookie cookieCheck = null;
// Request cookie from client's browser
cookieCheck =
Request.Cookies["HttpBrowserCookieCheck"];
// Check whether the cookie exists on client's
browser
if (cookieCheck == null) // Client browser does not
support cookies !! noooo !!
{
return false;
}
else // Client browser supports cookies !! yay !!
{
// Remove test cookie
Response.Cookies.Remove("HttpBrowserCookieCheck");
return true;
}
}
catch
{
return false;
}
finally
{
}
}
public void HttpBrowserCookieCreate(HttpRequest Request,
HttpResponse Response)
{
try
{
// Create cookie object
HttpCookie cookieCreate = new
HttpCookie("HttpBrowserCookieCheck");
// Set the cookies value
cookieCreate.Value = "true";
// Add the cookie
Response.Cookies.Add(cookieCreate);
}
catch
{
}
finally
{
}
}
Property (Note: This property is new in the .NET Framework version 2.0)
however it kept on returning true even when I disabled cookies in both
FireFox and Internet Explorer.
After a bit of googling I found that a lot of people were creating
cookies, then re-reading them; obviously if they could re-read the
cookie then they knew that the client's browser accepts cookies!
Simple. However, after writing a similar class to the ones I viewed
online, I'm still getting true returned, even when I disable cookies in
both FireFox and Internet Explorer.
With FireFox's cookie dialog open, I ran the application with cookies
turned off and indeed, FireFox showed no cookies were stored during the
HTTP request, however my code once again returned true!
When running the application with cookies turned on, FireFox showed one
cookie stored during HTTP request, and the code returned true.
Please advise.
public bool HttpBrowserCookieCheck(HttpRequest Request,
HttpResponse Response)
{
try
{
// Create cookie object
HttpCookie cookieCheck = null;
// Request cookie from client's browser
cookieCheck =
Request.Cookies["HttpBrowserCookieCheck"];
// Check whether the cookie exists on client's
browser
if (cookieCheck == null) // Client browser does not
support cookies !! noooo !!
{
return false;
}
else // Client browser supports cookies !! yay !!
{
// Remove test cookie
Response.Cookies.Remove("HttpBrowserCookieCheck");
return true;
}
}
catch
{
return false;
}
finally
{
}
}
public void HttpBrowserCookieCreate(HttpRequest Request,
HttpResponse Response)
{
try
{
// Create cookie object
HttpCookie cookieCreate = new
HttpCookie("HttpBrowserCookieCheck");
// Set the cookies value
cookieCreate.Value = "true";
// Add the cookie
Response.Cookies.Add(cookieCreate);
}
catch
{
}
finally
{
}
}