Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. C# and JavaScript. [modified]

C# and JavaScript. [modified]

Scheduled Pinned Locked Moved C#
javascripttoolscsharphtmlai-coding
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    Evgeni57
    wrote on last edited by
    #1

    Hi all, Sometime ago I wrote some automation tool to get content of some site. Everything worked fine untill one day... My C# code creted url string and made http hit. I used HttpRequest and Response. Request looked like http://somesite.con/param1=a&param2=b&param3=c Now, there was a change in the site and it always makes redirect to the url that looks like: http://somesite.con/param1=a&param2=b&param3=c&rnd=AbCdEfG1. With the fiddler I saw that actially web browser makes 2 hits: 1. The old one. 2. The new one. Now the response of the first hit contains some JS code that generates this random code (AbCdEfG1), concatinates it to the main url and makes redirect. As far as I understand I need to execute this JS from C#. It's may be done in the several ways and seems not too complex to do. But then I need to or: a. get back this random value from JS. b. allow to JS to make redirection, but need to get back the response. I prefer the b. because code that generates this random value always different (code generation or something). The code of JS is something like that:

    html>
    <head>
    <title></title>
    </head>

    <script type="text/javascript">
        function redirect()
        {
            var redirectLoc = window.location.href;
            if (redirectLoc.indexOf ('?')>-1) redirectLoc +="&"; else redirectLoc+="?";
            redirectLoc = redirectLoc.replace (/rnd=\[0-9a-zA-Z\]+&/,"");
            window.location = redirectLoc+'rnd='+f1();
        }
    </script>
    

    <script type="text/javascript">
    function sbbpWvum()
    {
    nCc = typeof "zCa";
    return String.fromCharCode(nCc.charCodeAt(4)^37);
    }
    function f1()
    {
    return sbbpWvum();
    }

    Any one can help with this isue? Thanks.

    modified on Friday, August 14, 2009 10:04 AM

    E 1 Reply Last reply
    0
    • E Evgeni57

      Hi all, Sometime ago I wrote some automation tool to get content of some site. Everything worked fine untill one day... My C# code creted url string and made http hit. I used HttpRequest and Response. Request looked like http://somesite.con/param1=a&param2=b&param3=c Now, there was a change in the site and it always makes redirect to the url that looks like: http://somesite.con/param1=a&param2=b&param3=c&rnd=AbCdEfG1. With the fiddler I saw that actially web browser makes 2 hits: 1. The old one. 2. The new one. Now the response of the first hit contains some JS code that generates this random code (AbCdEfG1), concatinates it to the main url and makes redirect. As far as I understand I need to execute this JS from C#. It's may be done in the several ways and seems not too complex to do. But then I need to or: a. get back this random value from JS. b. allow to JS to make redirection, but need to get back the response. I prefer the b. because code that generates this random value always different (code generation or something). The code of JS is something like that:

      html>
      <head>
      <title></title>
      </head>

      <script type="text/javascript">
          function redirect()
          {
              var redirectLoc = window.location.href;
              if (redirectLoc.indexOf ('?')>-1) redirectLoc +="&"; else redirectLoc+="?";
              redirectLoc = redirectLoc.replace (/rnd=\[0-9a-zA-Z\]+&/,"");
              window.location = redirectLoc+'rnd='+f1();
          }
      </script>
      

      <script type="text/javascript">
      function sbbpWvum()
      {
      nCc = typeof "zCa";
      return String.fromCharCode(nCc.charCodeAt(4)^37);
      }
      function f1()
      {
      return sbbpWvum();
      }

      Any one can help with this isue? Thanks.

      modified on Friday, August 14, 2009 10:04 AM

      E Offline
      E Offline
      Evgeni57
      wrote on last edited by
      #2

      Still no ideas :)?

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups