Detecting if Browser Accepts Cookies & JavaScript

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • SHarris

    Detecting if Browser Accepts Cookies & JavaScript

    Hello,
    In our new intranet ASP.NET project, two requirements are that the browser
    accept cookies AND JavaScript. We are requiring the use of Internet
    Explorer 6+.

    1. Using C# in an ASP.NET application, how can we code the project to check
    to make sure the browser accepts cookies?
    2. Where would we put this code? In Global.asax?
    3. Using C# in an ASP.NET application, how can we code the project to
    detect and make sure the browser is configured to run JavaScript?
    4. Where would we put this code?

    Thanks in advance!


  • Juan T. Llibre

    #2
    Re: Detecting if Browser Accepts Cookies & JavaScript

    Use

    Request.Browser .Cookies
    and
    Request.Browser .JavaScript

    If the value returned is true, they are enabled.
    If false they are not enabled.

    PLace it in the login page's Page_Load,
    and redirect as appropiate ( maybe to a page
    which tells the user that they are a requisite. )



    Juan T. Llibre
    ASP.NET MVP

    Foros de ASP.NET en Español
    =============== ======

    "SHarris" <sharris@nospam .com> wrote in message
    news:eh7c5LGEFH A.1012@TK2MSFTN GP14.phx.gbl...[color=blue]
    > Hello,
    > In our new intranet ASP.NET project, two requirements are that the browser
    > accept cookies AND JavaScript. We are requiring the use of Internet
    > Explorer 6+.
    >
    > 1. Using C# in an ASP.NET application, how can we code the project to
    > check
    > to make sure the browser accepts cookies?
    > 2. Where would we put this code? In Global.asax?
    > 3. Using C# in an ASP.NET application, how can we code the project to
    > detect and make sure the browser is configured to run JavaScript?
    > 4. Where would we put this code?
    >
    > Thanks in advance!
    >
    >[/color]


    Comment

    • SHarris

      #3
      Re: Detecting if Browser Accepts Cookies &amp; JavaScript

      Thanks Juan! We'll check it out.


      "Juan T. Llibre" <nomailreplies@ nowhere.com> wrote in message
      news:ejemrVGEFH A.3976@tk2msftn gp13.phx.gbl...[color=blue]
      > Use
      >
      > Request.Browser .Cookies
      > and
      > Request.Browser .JavaScript
      >
      > If the value returned is true, they are enabled.
      > If false they are not enabled.
      >
      > PLace it in the login page's Page_Load,
      > and redirect as appropiate ( maybe to a page
      > which tells the user that they are a requisite. )
      >
      >
      >
      > Juan T. Llibre
      > ASP.NET MVP
      > http://asp.net.do/foros/
      > Foros de ASP.NET en Español
      > =============== ======
      >
      > "SHarris" <sharris@nospam .com> wrote in message
      > news:eh7c5LGEFH A.1012@TK2MSFTN GP14.phx.gbl...[color=green]
      > > Hello,
      > > In our new intranet ASP.NET project, two requirements are that the[/color][/color]
      browser[color=blue][color=green]
      > > accept cookies AND JavaScript. We are requiring the use of Internet
      > > Explorer 6+.
      > >
      > > 1. Using C# in an ASP.NET application, how can we code the project to
      > > check
      > > to make sure the browser accepts cookies?
      > > 2. Where would we put this code? In Global.asax?
      > > 3. Using C# in an ASP.NET application, how can we code the project to
      > > detect and make sure the browser is configured to run JavaScript?
      > > 4. Where would we put this code?
      > >
      > > Thanks in advance!
      > >
      > >[/color]
      >
      >[/color]


      Comment

      • Juan T. Llibre

        #4
        Re: Detecting if Browser Accepts Cookies &amp; JavaScript

        The standard way of doing this is by using
        "the proof is in the pudding" programming.

        If testing for cookies, issue a cookie and read it
        after a redirect. If it's there, fine. If not...you know.

        The same for JavaScript.
        Set a variable, and test for it later in the page..



        Juan T. Llibre
        ASP.NET MVP

        Foros de ASP.NET en Español
        =============== ======

        "SHarris" <sharris@nospam .com> wrote in message
        news:O2AUMOHEFH A.1836@tk2msftn gp13.phx.gbl...[color=blue]
        > Thanks Juan! We'll check it out.
        >
        >
        > "Juan T. Llibre" <nomailreplies@ nowhere.com> wrote in message
        > news:ejemrVGEFH A.3976@tk2msftn gp13.phx.gbl...[color=green]
        >> Use
        >>
        >> Request.Browser .Cookies
        >> and
        >> Request.Browser .JavaScript
        >>
        >> If the value returned is true, they are enabled.
        >> If false they are not enabled.
        >>
        >> PLace it in the login page's Page_Load,
        >> and redirect as appropiate ( maybe to a page
        >> which tells the user that they are a requisite. )
        >>
        >>
        >>
        >> Juan T. Llibre
        >> ASP.NET MVP
        >> http://asp.net.do/foros/
        >> Foros de ASP.NET en Español
        >> =============== ======
        >>
        >> "SHarris" <sharris@nospam .com> wrote in message
        >> news:eh7c5LGEFH A.1012@TK2MSFTN GP14.phx.gbl...[color=darkred]
        >> > Hello,
        >> > In our new intranet ASP.NET project, two requirements are that the[/color][/color]
        > browser[color=green][color=darkred]
        >> > accept cookies AND JavaScript. We are requiring the use of Internet
        >> > Explorer 6+.
        >> >
        >> > 1. Using C# in an ASP.NET application, how can we code the project to
        >> > check
        >> > to make sure the browser accepts cookies?
        >> > 2. Where would we put this code? In Global.asax?
        >> > 3. Using C# in an ASP.NET application, how can we code the project to
        >> > detect and make sure the browser is configured to run JavaScript?
        >> > 4. Where would we put this code?
        >> >
        >> > Thanks in advance!
        >> >
        >> >[/color]
        >>
        >>[/color]
        >
        >[/color]


        Comment

        • SHarris

          #5
          Re: Detecting if Browser Accepts Cookies &amp; JavaScript

          Again, thanks for the info. But, after reviewing Request.Browser .Cookies
          and Request.Browser .JavaScript, these two properties simply return true if
          browser client "supports" Cookies and JavaScript, respectively. This is
          good to know.

          But, what we really need is a way to check and make sure the user has not
          disabled Cookies and JavaScript through security settings. Any thoughts?


          "Juan T. Llibre" <nomailreplies@ nowhere.com> wrote in message
          news:ejemrVGEFH A.3976@tk2msftn gp13.phx.gbl...[color=blue]
          > Use
          >
          > Request.Browser .Cookies
          > and
          > Request.Browser .JavaScript
          >
          > If the value returned is true, they are enabled.
          > If false they are not enabled.
          >
          > PLace it in the login page's Page_Load,
          > and redirect as appropiate ( maybe to a page
          > which tells the user that they are a requisite. )
          >
          >
          >
          > Juan T. Llibre
          > ASP.NET MVP
          > http://asp.net.do/foros/
          > Foros de ASP.NET en Español
          > =============== ======
          >
          > "SHarris" <sharris@nospam .com> wrote in message
          > news:eh7c5LGEFH A.1012@TK2MSFTN GP14.phx.gbl...[color=green]
          > > Hello,
          > > In our new intranet ASP.NET project, two requirements are that the[/color][/color]
          browser[color=blue][color=green]
          > > accept cookies AND JavaScript. We are requiring the use of Internet
          > > Explorer 6+.
          > >
          > > 1. Using C# in an ASP.NET application, how can we code the project to
          > > check
          > > to make sure the browser accepts cookies?
          > > 2. Where would we put this code? In Global.asax?
          > > 3. Using C# in an ASP.NET application, how can we code the project to
          > > detect and make sure the browser is configured to run JavaScript?
          > > 4. Where would we put this code?
          > >
          > > Thanks in advance!
          > >
          > >[/color]
          >
          >[/color]


          Comment

          • bruce barker

            #6
            Re: Detecting if Browser Accepts Cookies &amp; JavaScript

            to tell if cookies are enabled, set a cookie value, and redirect to a page
            that checks if the cookie is set.

            to tell if javascript is enabled: try:

            <html>
            <head>
            <META HTTP-EQUIV=Refresh CONTENT="1;
            URL=http://yoursite.com/vir/jtest.aspx">
            </head>
            <body>
            <form>
            <input type=hidden id=jtest name=jtest value="no">
            <script>documen t.getElementByI d('jtest').valu e="yes";documen t.forms[0].submi
            t();<script>
            </form>
            if this page does not refresh automatically, click <a
            href="nometaref resh.aspx">here </a>
            </body>
            </html>

            -- bruce (sqlwork.com)



            "SHarris" <sharris@nospam .com> wrote in message
            news:O91OvVHEFH A.1012@TK2MSFTN GP14.phx.gbl...
            | Again, thanks for the info. But, after reviewing Request.Browser .Cookies
            | and Request.Browser .JavaScript, these two properties simply return true if
            | browser client "supports" Cookies and JavaScript, respectively. This is
            | good to know.
            |
            | But, what we really need is a way to check and make sure the user has not
            | disabled Cookies and JavaScript through security settings. Any thoughts?
            |
            |
            | "Juan T. Llibre" <nomailreplies@ nowhere.com> wrote in message
            | news:ejemrVGEFH A.3976@tk2msftn gp13.phx.gbl...
            | > Use
            | >
            | > Request.Browser .Cookies
            | > and
            | > Request.Browser .JavaScript
            | >
            | > If the value returned is true, they are enabled.
            | > If false they are not enabled.
            | >
            | > PLace it in the login page's Page_Load,
            | > and redirect as appropiate ( maybe to a page
            | > which tells the user that they are a requisite. )
            | >
            | >
            | >
            | > Juan T. Llibre
            | > ASP.NET MVP
            | > http://asp.net.do/foros/
            | > Foros de ASP.NET en Español
            | > =============== ======
            | >
            | > "SHarris" <sharris@nospam .com> wrote in message
            | > news:eh7c5LGEFH A.1012@TK2MSFTN GP14.phx.gbl...
            | > > Hello,
            | > > In our new intranet ASP.NET project, two requirements are that the
            | browser
            | > > accept cookies AND JavaScript. We are requiring the use of Internet
            | > > Explorer 6+.
            | > >
            | > > 1. Using C# in an ASP.NET application, how can we code the project to
            | > > check
            | > > to make sure the browser accepts cookies?
            | > > 2. Where would we put this code? In Global.asax?
            | > > 3. Using C# in an ASP.NET application, how can we code the project to
            | > > detect and make sure the browser is configured to run JavaScript?
            | > > 4. Where would we put this code?
            | > >
            | > > Thanks in advance!
            | > >
            | > >
            | >
            | >
            |
            |


            Comment

            • clintonG

              #7
              Re: Detecting if Browser Accepts Cookies &amp; JavaScript

              Why is a redirection alleged to be required?

              --
              <%= Clinton Gallagher
              METROmilwaukee "Regional Information Services"
              NET csgallagher AT metromilwaukee. com
              URL http://clintongallagher.metromilwaukee.com/



              "bruce barker" <nospam_brubar@ safeco.com> wrote in message
              news:%23$2g14HE FHA.1124@TK2MSF TNGP14.phx.gbl. ..[color=blue]
              > to tell if cookies are enabled, set a cookie value, and redirect to a page
              > that checks if the cookie is set.
              >
              > to tell if javascript is enabled: try:
              >
              > <html>
              > <head>
              > <META HTTP-EQUIV=Refresh CONTENT="1;
              > URL=http://yoursite.com/vir/jtest.aspx">
              > </head>
              > <body>
              > <form>
              > <input type=hidden id=jtest name=jtest value="no">
              >[/color]
              <script>documen t.getElementByI d('jtest').valu e="yes";documen t.forms[0].submi[color=blue]
              > t();<script>
              > </form>
              > if this page does not refresh automatically, click <a
              > href="nometaref resh.aspx">here </a>
              > </body>
              > </html>
              >
              > -- bruce (sqlwork.com)
              >
              >
              >
              > "SHarris" <sharris@nospam .com> wrote in message
              > news:O91OvVHEFH A.1012@TK2MSFTN GP14.phx.gbl...
              > | Again, thanks for the info. But, after reviewing[/color]
              Request.Browser .Cookies[color=blue]
              > | and Request.Browser .JavaScript, these two properties simply return true[/color]
              if[color=blue]
              > | browser client "supports" Cookies and JavaScript, respectively. This is
              > | good to know.
              > |
              > | But, what we really need is a way to check and make sure the user has[/color]
              not[color=blue]
              > | disabled Cookies and JavaScript through security settings. Any[/color]
              thoughts?[color=blue]
              > |
              > |
              > | "Juan T. Llibre" <nomailreplies@ nowhere.com> wrote in message
              > | news:ejemrVGEFH A.3976@tk2msftn gp13.phx.gbl...
              > | > Use
              > | >
              > | > Request.Browser .Cookies
              > | > and
              > | > Request.Browser .JavaScript
              > | >
              > | > If the value returned is true, they are enabled.
              > | > If false they are not enabled.
              > | >
              > | > PLace it in the login page's Page_Load,
              > | > and redirect as appropiate ( maybe to a page
              > | > which tells the user that they are a requisite. )
              > | >
              > | >
              > | >
              > | > Juan T. Llibre
              > | > ASP.NET MVP
              > | > http://asp.net.do/foros/
              > | > Foros de ASP.NET en Español
              > | > =============== ======
              > | >
              > | > "SHarris" <sharris@nospam .com> wrote in message
              > | > news:eh7c5LGEFH A.1012@TK2MSFTN GP14.phx.gbl...
              > | > > Hello,
              > | > > In our new intranet ASP.NET project, two requirements are that the
              > | browser
              > | > > accept cookies AND JavaScript. We are requiring the use of Internet
              > | > > Explorer 6+.
              > | > >
              > | > > 1. Using C# in an ASP.NET application, how can we code the project[/color]
              to[color=blue]
              > | > > check
              > | > > to make sure the browser accepts cookies?
              > | > > 2. Where would we put this code? In Global.asax?
              > | > > 3. Using C# in an ASP.NET application, how can we code the project[/color]
              to[color=blue]
              > | > > detect and make sure the browser is configured to run JavaScript?
              > | > > 4. Where would we put this code?
              > | > >
              > | > > Thanks in advance!
              > | > >
              > | > >
              > | >
              > | >
              > |
              > |
              >
              >[/color]


              Comment

              • Juan T. Llibre

                #8
                Re: Detecting if Browser Accepts Cookies &amp; JavaScript

                You can't set a cookie and read it without
                the client going back to the server ?

                Back in the "classic asp" days, I used a workaround
                which "tricked" you into believing it was the same page,
                but what happened was that I'd set the setting cookie
                in a 0 pixel display frame, and read it in the first page
                the client saw, but that was just sleight of hand.

                I suppose you could set a cookie in Session_OnStart ,
                but to retrieve it, wouldn't you need for the client to go
                back to the server ?

                Why do you say "alleged" ? How would you do it ?
                ( Without a second page being called ? )




                Juan T. Llibre
                ASP.NET MVP

                Foros de ASP.NET en Español
                =============== ======

                "clintonG" <csgallagher@RE MOVETHISTEXTmet romilwaukee.com > wrote in message
                news:OBSO5qIEFH A.1396@tk2msftn gp13.phx.gbl...[color=blue]
                > Why is a redirection alleged to be required?
                > <%= Clinton Gallagher[/color]

                [color=blue]
                > "bruce barker" <nospam_brubar@ safeco.com> wrote in message
                > news:%23$2g14HE FHA.1124@TK2MSF TNGP14.phx.gbl. ..[color=green]
                >> to tell if cookies are enabled, set a cookie value, and redirect to a
                >> page
                >> that checks if the cookie is set.
                >>
                >> to tell if javascript is enabled: try:
                >>
                >> <html>
                >> <head>
                >> <META HTTP-EQUIV=Refresh CONTENT="1;
                >> URL=http://yoursite.com/vir/jtest.aspx">
                >> </head>
                >> <body>
                >> <form>
                >> <input type=hidden id=jtest name=jtest value="no">
                >>[/color]
                > <script>documen t.getElementByI d('jtest').valu e="yes";documen t.forms[0].submi[color=green]
                >> t();<script>
                >> </form>
                >> if this page does not refresh automatically, click <a
                >> href="nometaref resh.aspx">here </a>
                >> </body>
                >> </html>
                >>
                >> -- bruce (sqlwork.com)
                >>
                >>
                >>
                >> "SHarris" <sharris@nospam .com> wrote in message
                >> news:O91OvVHEFH A.1012@TK2MSFTN GP14.phx.gbl...
                >> | Again, thanks for the info. But, after reviewing[/color]
                > Request.Browser .Cookies[color=green]
                >> | and Request.Browser .JavaScript, these two properties simply return true[/color]
                > if[color=green]
                >> | browser client "supports" Cookies and JavaScript, respectively. This
                >> is
                >> | good to know.
                >> |
                >> | But, what we really need is a way to check and make sure the user has[/color]
                > not[color=green]
                >> | disabled Cookies and JavaScript through security settings. Any[/color]
                > thoughts?[color=green]
                >> |
                >> |
                >> | "Juan T. Llibre" <nomailreplies@ nowhere.com> wrote in message
                >> | news:ejemrVGEFH A.3976@tk2msftn gp13.phx.gbl...
                >> | > Use
                >> | >
                >> | > Request.Browser .Cookies
                >> | > and
                >> | > Request.Browser .JavaScript
                >> | >
                >> | > If the value returned is true, they are enabled.
                >> | > If false they are not enabled.
                >> | >
                >> | > PLace it in the login page's Page_Load,
                >> | > and redirect as appropiate ( maybe to a page
                >> | > which tells the user that they are a requisite. )
                >> | >
                >> | >
                >> | >
                >> | > Juan T. Llibre
                >> | > ASP.NET MVP
                >> | > http://asp.net.do/foros/
                >> | > Foros de ASP.NET en Español
                >> | > =============== ======
                >> | >
                >> | > "SHarris" <sharris@nospam .com> wrote in message
                >> | > news:eh7c5LGEFH A.1012@TK2MSFTN GP14.phx.gbl...
                >> | > > Hello,
                >> | > > In our new intranet ASP.NET project, two requirements are that the
                >> | browser
                >> | > > accept cookies AND JavaScript. We are requiring the use of
                >> Internet
                >> | > > Explorer 6+.
                >> | > >
                >> | > > 1. Using C# in an ASP.NET application, how can we code the project[/color]
                > to[color=green]
                >> | > > check
                >> | > > to make sure the browser accepts cookies?
                >> | > > 2. Where would we put this code? In Global.asax?
                >> | > > 3. Using C# in an ASP.NET application, how can we code the project[/color]
                > to[color=green]
                >> | > > detect and make sure the browser is configured to run JavaScript?
                >> | > > 4. Where would we put this code?
                >> | > >
                >> | > > Thanks in advance!
                >> | > >
                >> | > >
                >> | >
                >> | >
                >> |
                >> |
                >>
                >>[/color]
                >
                >[/color]


                Comment

                • clintonG

                  #9
                  Re: Detecting if Browser Accepts Cookies &amp; JavaScript

                  Poor choice of words Juan.

                  I've been wondering if there is an optimal way to do detection without using
                  redirection to avoid being penalized or banned by Google and other search
                  engines.

                  We've been wanting to load domain.com/appname/default.aspx and do utility
                  functions such as detection in the default.aspx and then redirect to
                  appname.aspx but don't know if this would result in getting slapped by
                  Google.

                  <%= Clinton Gallagher

                  "Juan T. Llibre" <nomailreplies@ nowhere.com> wrote in message
                  news:eutVQ5IEFH A.2632@TK2MSFTN GP12.phx.gbl...[color=blue]
                  > You can't set a cookie and read it without
                  > the client going back to the server ?
                  >
                  > Back in the "classic asp" days, I used a workaround
                  > which "tricked" you into believing it was the same page,
                  > but what happened was that I'd set the setting cookie
                  > in a 0 pixel display frame, and read it in the first page
                  > the client saw, but that was just sleight of hand.
                  >
                  > I suppose you could set a cookie in Session_OnStart ,
                  > but to retrieve it, wouldn't you need for the client to go
                  > back to the server ?
                  >
                  > Why do you say "alleged" ? How would you do it ?
                  > ( Without a second page being called ? )
                  >
                  >
                  >
                  >
                  > Juan T. Llibre
                  > ASP.NET MVP
                  > http://asp.net.do/foros/
                  > Foros de ASP.NET en Español
                  > =============== ======
                  >
                  > "clintonG" <csgallagher@RE MOVETHISTEXTmet romilwaukee.com > wrote in message
                  > news:OBSO5qIEFH A.1396@tk2msftn gp13.phx.gbl...[color=green]
                  > > Why is a redirection alleged to be required?
                  > > <%= Clinton Gallagher[/color]
                  >
                  >[color=green]
                  > > "bruce barker" <nospam_brubar@ safeco.com> wrote in message
                  > > news:%23$2g14HE FHA.1124@TK2MSF TNGP14.phx.gbl. ..[color=darkred]
                  > >> to tell if cookies are enabled, set a cookie value, and redirect to a
                  > >> page
                  > >> that checks if the cookie is set.
                  > >>
                  > >> to tell if javascript is enabled: try:
                  > >>
                  > >> <html>
                  > >> <head>
                  > >> <META HTTP-EQUIV=Refresh CONTENT="1;
                  > >> URL=http://yoursite.com/vir/jtest.aspx">
                  > >> </head>
                  > >> <body>
                  > >> <form>
                  > >> <input type=hidden id=jtest name=jtest value="no">
                  > >>[/color]
                  > >[/color][/color]
                  <script>documen t.getElementByI d('jtest').valu e="yes";documen t.forms[0].submi[color=blue][color=green][color=darkred]
                  > >> t();<script>
                  > >> </form>
                  > >> if this page does not refresh automatically, click <a
                  > >> href="nometaref resh.aspx">here </a>
                  > >> </body>
                  > >> </html>
                  > >>
                  > >> -- bruce (sqlwork.com)
                  > >>
                  > >>
                  > >>
                  > >> "SHarris" <sharris@nospam .com> wrote in message
                  > >> news:O91OvVHEFH A.1012@TK2MSFTN GP14.phx.gbl...
                  > >> | Again, thanks for the info. But, after reviewing[/color]
                  > > Request.Browser .Cookies[color=darkred]
                  > >> | and Request.Browser .JavaScript, these two properties simply return[/color][/color][/color]
                  true[color=blue][color=green]
                  > > if[color=darkred]
                  > >> | browser client "supports" Cookies and JavaScript, respectively. This
                  > >> is
                  > >> | good to know.
                  > >> |
                  > >> | But, what we really need is a way to check and make sure the user has[/color]
                  > > not[color=darkred]
                  > >> | disabled Cookies and JavaScript through security settings. Any[/color]
                  > > thoughts?[color=darkred]
                  > >> |
                  > >> |
                  > >> | "Juan T. Llibre" <nomailreplies@ nowhere.com> wrote in message
                  > >> | news:ejemrVGEFH A.3976@tk2msftn gp13.phx.gbl...
                  > >> | > Use
                  > >> | >
                  > >> | > Request.Browser .Cookies
                  > >> | > and
                  > >> | > Request.Browser .JavaScript
                  > >> | >
                  > >> | > If the value returned is true, they are enabled.
                  > >> | > If false they are not enabled.
                  > >> | >
                  > >> | > PLace it in the login page's Page_Load,
                  > >> | > and redirect as appropiate ( maybe to a page
                  > >> | > which tells the user that they are a requisite. )
                  > >> | >
                  > >> | >
                  > >> | >
                  > >> | > Juan T. Llibre
                  > >> | > ASP.NET MVP
                  > >> | > http://asp.net.do/foros/
                  > >> | > Foros de ASP.NET en Español
                  > >> | > =============== ======
                  > >> | >
                  > >> | > "SHarris" <sharris@nospam .com> wrote in message
                  > >> | > news:eh7c5LGEFH A.1012@TK2MSFTN GP14.phx.gbl...
                  > >> | > > Hello,
                  > >> | > > In our new intranet ASP.NET project, two requirements are that[/color][/color][/color]
                  the[color=blue][color=green][color=darkred]
                  > >> | browser
                  > >> | > > accept cookies AND JavaScript. We are requiring the use of
                  > >> Internet
                  > >> | > > Explorer 6+.
                  > >> | > >
                  > >> | > > 1. Using C# in an ASP.NET application, how can we code the[/color][/color][/color]
                  project[color=blue][color=green]
                  > > to[color=darkred]
                  > >> | > > check
                  > >> | > > to make sure the browser accepts cookies?
                  > >> | > > 2. Where would we put this code? In Global.asax?
                  > >> | > > 3. Using C# in an ASP.NET application, how can we code the[/color][/color][/color]
                  project[color=blue][color=green]
                  > > to[color=darkred]
                  > >> | > > detect and make sure the browser is configured to run JavaScript?
                  > >> | > > 4. Where would we put this code?
                  > >> | > >
                  > >> | > > Thanks in advance!
                  > >> | > >
                  > >> | > >
                  > >> | >
                  > >> | >
                  > >> |
                  > >> |
                  > >>
                  > >>[/color]
                  > >
                  > >[/color]
                  >
                  >[/color]


                  Comment

                  • clintonG

                    #10
                    Re: Detecting if Browser Accepts Cookies &amp; JavaScript

                    Poor choice of words Juan.

                    I've been wondering if there is an optimal way to do detection without using
                    redirection to avoid being penalized or banned by Google and other search
                    engines.

                    We've been wanting to load domain.com/appname/default.aspx and do utility
                    functions such as detection in the default.aspx and then redirect to
                    appname.aspx but don't know if this would result in getting slapped by
                    Google.

                    <%= Clinton Gallagher

                    "Juan T. Llibre" <nomailreplies@ nowhere.com> wrote in message
                    news:eutVQ5IEFH A.2632@TK2MSFTN GP12.phx.gbl...[color=blue]
                    > You can't set a cookie and read it without
                    > the client going back to the server ?
                    >
                    > Back in the "classic asp" days, I used a workaround
                    > which "tricked" you into believing it was the same page,
                    > but what happened was that I'd set the setting cookie
                    > in a 0 pixel display frame, and read it in the first page
                    > the client saw, but that was just sleight of hand.
                    >
                    > I suppose you could set a cookie in Session_OnStart ,
                    > but to retrieve it, wouldn't you need for the client to go
                    > back to the server ?
                    >
                    > Why do you say "alleged" ? How would you do it ?
                    > ( Without a second page being called ? )
                    >
                    >
                    >
                    >
                    > Juan T. Llibre
                    > ASP.NET MVP
                    > http://asp.net.do/foros/
                    > Foros de ASP.NET en Español
                    > =============== ======
                    >
                    > "clintonG" <csgallagher@RE MOVETHISTEXTmet romilwaukee.com > wrote in message
                    > news:OBSO5qIEFH A.1396@tk2msftn gp13.phx.gbl...[color=green]
                    > > Why is a redirection alleged to be required?
                    > > <%= Clinton Gallagher[/color]
                    >
                    >[color=green]
                    > > "bruce barker" <nospam_brubar@ safeco.com> wrote in message
                    > > news:%23$2g14HE FHA.1124@TK2MSF TNGP14.phx.gbl. ..[color=darkred]
                    > >> to tell if cookies are enabled, set a cookie value, and redirect to a
                    > >> page
                    > >> that checks if the cookie is set.
                    > >>
                    > >> to tell if javascript is enabled: try:
                    > >>
                    > >> <html>
                    > >> <head>
                    > >> <META HTTP-EQUIV=Refresh CONTENT="1;
                    > >> URL=http://yoursite.com/vir/jtest.aspx">
                    > >> </head>
                    > >> <body>
                    > >> <form>
                    > >> <input type=hidden id=jtest name=jtest value="no">
                    > >>[/color]
                    > >[/color][/color]
                    <script>documen t.getElementByI d('jtest').valu e="yes";documen t.forms[0].submi[color=blue][color=green][color=darkred]
                    > >> t();<script>
                    > >> </form>
                    > >> if this page does not refresh automatically, click <a
                    > >> href="nometaref resh.aspx">here </a>
                    > >> </body>
                    > >> </html>
                    > >>
                    > >> -- bruce (sqlwork.com)
                    > >>
                    > >>
                    > >>
                    > >> "SHarris" <sharris@nospam .com> wrote in message
                    > >> news:O91OvVHEFH A.1012@TK2MSFTN GP14.phx.gbl...
                    > >> | Again, thanks for the info. But, after reviewing[/color]
                    > > Request.Browser .Cookies[color=darkred]
                    > >> | and Request.Browser .JavaScript, these two properties simply return[/color][/color][/color]
                    true[color=blue][color=green]
                    > > if[color=darkred]
                    > >> | browser client "supports" Cookies and JavaScript, respectively. This
                    > >> is
                    > >> | good to know.
                    > >> |
                    > >> | But, what we really need is a way to check and make sure the user has[/color]
                    > > not[color=darkred]
                    > >> | disabled Cookies and JavaScript through security settings. Any[/color]
                    > > thoughts?[color=darkred]
                    > >> |
                    > >> |
                    > >> | "Juan T. Llibre" <nomailreplies@ nowhere.com> wrote in message
                    > >> | news:ejemrVGEFH A.3976@tk2msftn gp13.phx.gbl...
                    > >> | > Use
                    > >> | >
                    > >> | > Request.Browser .Cookies
                    > >> | > and
                    > >> | > Request.Browser .JavaScript
                    > >> | >
                    > >> | > If the value returned is true, they are enabled.
                    > >> | > If false they are not enabled.
                    > >> | >
                    > >> | > PLace it in the login page's Page_Load,
                    > >> | > and redirect as appropiate ( maybe to a page
                    > >> | > which tells the user that they are a requisite. )
                    > >> | >
                    > >> | >
                    > >> | >
                    > >> | > Juan T. Llibre
                    > >> | > ASP.NET MVP
                    > >> | > http://asp.net.do/foros/
                    > >> | > Foros de ASP.NET en Español
                    > >> | > =============== ======
                    > >> | >
                    > >> | > "SHarris" <sharris@nospam .com> wrote in message
                    > >> | > news:eh7c5LGEFH A.1012@TK2MSFTN GP14.phx.gbl...
                    > >> | > > Hello,
                    > >> | > > In our new intranet ASP.NET project, two requirements are that[/color][/color][/color]
                    the[color=blue][color=green][color=darkred]
                    > >> | browser
                    > >> | > > accept cookies AND JavaScript. We are requiring the use of
                    > >> Internet
                    > >> | > > Explorer 6+.
                    > >> | > >
                    > >> | > > 1. Using C# in an ASP.NET application, how can we code the[/color][/color][/color]
                    project[color=blue][color=green]
                    > > to[color=darkred]
                    > >> | > > check
                    > >> | > > to make sure the browser accepts cookies?
                    > >> | > > 2. Where would we put this code? In Global.asax?
                    > >> | > > 3. Using C# in an ASP.NET application, how can we code the[/color][/color][/color]
                    project[color=blue][color=green]
                    > > to[color=darkred]
                    > >> | > > detect and make sure the browser is configured to run JavaScript?
                    > >> | > > 4. Where would we put this code?
                    > >> | > >
                    > >> | > > Thanks in advance!
                    > >> | > >
                    > >> | > >
                    > >> | >
                    > >> | >
                    > >> |
                    > >> |
                    > >>
                    > >>[/color]
                    > >
                    > >[/color]
                    >
                    >[/color]


                    Comment

                    Working...