| Author: Payal Jain 04 Jul 2008 | Member Level: Gold | Rating: Points: 6 |
The following code example shows how to detect blocked cookies in C#. This code would be placed within the first page users will access on your site (usually default.aspx or Global.ascx).
// Cookie detection. // Is our cookie not yet set and the url parameter empty? If so, lets set the cookie. if (Session["CookieCheck"] == null && Request.QueryString["c"] == null) { // Set the cookie and redirect so we can try to detect it. Session["CookieCheck"] = "1"; Response.Redirect("default.aspx?c=1", true);
return; } else { // Detect the cookie. if (Session["CookieCheck"] == null || Session["CookieCheck"].ToString() != "1") { // Cookies are disabled Response.Redirect("NoCookies.aspx", true); return; } } Upon detecting that a user is blocking cookies, the user will be redirected to a NoCookies.aspx page. This page can notify the user in a friendly manner that the web application requires cookies and provide steps to enable them.
|
| Author: Payal Jain 04 Jul 2008 | Member Level: Gold | Rating: Points: 0 |
http://www.aspfaqs.com/webtech/082400-1.shtml
|
| Author: kumar 04 Jul 2008 | Member Level: Gold | Rating: Points: 1 |
Hi,
tks for ur response but this is not working and ur creating the session not cookies.
kk
|