0

Hi
I am developing the asp.net using Vb.net code. I need to notify my client if client's browser is disabled the cookies, when the launch the asp.page.

Pls help me.

Maideen

3
Contributors
3
Replies
14
Views
3 Years
Discussion Span
Last Post by Maideen
0

According to this MSDN article, you have to test by writing then reading the cookie. If you cannot read the cookie you wrote, you assume that cookies are turned off in the browser. Then, you can display a message to the user about the problem.

http://msdn.microsoft.com/en-us/library/ms178194.aspx

Read the section: Determining Whether a Browser Accepts Cookies

0

Thanks all of you. solved. below is the code

function CookieSetText()
        {
              var cookieEnabled=(navigator.cookieEnabled)? true : false
              //if not IE4+ nor NS6+
              if (typeof navigator.cookieEnabled == "undefined" && !cookieEnabled)
              {
                document.cookie="testcookie"
                cookieEnabled=(document.cookie.indexOf("testcookie")!=-1)? true : false
              }
              if (cookieEnabled)
              {
                document.write("Cookies are enabled");
              }
              else
              {
                document.write("Cookies are not enabled");
              }
        }
window.onload = function () {
            //calling the function on page load
            CookieSetText();
        };
This question has already been answered. 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.