المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : C# and **********. [modified]



C# Programming
08-14-2009, 06:29 PM
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>






function redirect()
{
var redirectLoc = ****************.href;
if (redirectLoc.indexOf ('?')>-1) redirectLoc +="&"; else redirectLoc+="?";
redirectLoc = redirectLoc.replace (/rnd=[0-9a-zA-Z]+&/,"");
**************** = redirectLoc+'rnd='+f1();
}


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