1

Topic: Authorization on a site with jsp

Day kind! There is a site https://www.portfolio123.com/, want to pull the data from it, but it is impossible to become authorized from own application. I research request through utilities of browsers which display transmission of my "manual" requests POST. The request goes the such:" LoginUsername=@.ru&LoginPassword=&LoginRememberMe=1&Login=Login&url=index.jsp "How to represent index.jsp, remains a riddle.//we Create request HttpWebResponse result = null; HttpWebRequest req = (HttpWebRequest) HttpWebRequest. Create ("https://www.portfolio123.com/login.jsp?url="); req. Method ="POST"; req. ContentType ="application/x-www-form-urlencoded"; byte [] SomeBytes = null; string FormParams ="LoginUsername=@.ru&LoginPassword=&LoginRememberMe=1&Login=Login&url=index.jsp"; SomeBytes = Encoding. UTF8.GetBytes (FormParams); req. ContentLength = SomeBytes. Length; Stream newStream = req. GetRequestStream (); newStream. Write (SomeBytes, 0, SomeBytes. Length); newStream. Close (); result = (HttpWebResponse) req. GetResponse ();//It is received  string [] cookieVal = null; if (result. Headers ["Set-Cookie"]! = null) cookieVal = result. Headers ["Set-Cookie"].Split (new char [] {', '}); Stream ReceiveStream = result. GetResponseStream (); Encoding encode = Encoding. GetEncoding ("utf-8"); StreamReader sr = new StreamReader (ReceiveStream, encode); string answer = sr. ReadToEnd (); sr. Close (); result. Close (); CookieContainer cookie = new CookieContainer (); foreach (string cook in cookieVal) {string [] cookie1 = cook. Split (new char [] {'; '}); cookie. Add (new Cookie (cookie1 [0].Split (new char [] {' = '}) [0], cookie1 [0].Split (new char [] {' = '}) [1], cookie1 [1].Split (new char [] {' = '}) [1], "www.portfolio123.com"));} //request about downloading of the file necessary to us, using  string url = "https://www.portfolio123.com/p123/Downl … =Balanced4"; HttpWebRequest request = (HttpWebRequest) WebRequest. Create (url); request. CookieContainer = cookie; request. Method = "GET"; request. ContentType = "application/octet-stream;charset=ISO-8859-1"; HttpWebResponse response = (HttpWebResponse) request. GetResponse (); Stream ReceiveStream1 = response. GetResponseStream (); StreamReader sr1 = new StreamReader (ReceiveStream1, encode); string html = sr1.ReadToEnd (); response. Close (); - the code sample, should do request about authorization, receive  and use them for the further operation, namely for file downloading. But as a result that already only did not try, same - we receive a page html with request about authorization! I suppose, what authorization does not transit also business in index.jsp but how it to prepare?

2

Re: Authorization on a site with jsp

Through utilities  it is not necessary, therefore as they do not show that your program sends. Take Fiddler, there it will be visible that sends the browser, and that the program. It will be possible even to preempt a broad gull in files and to compare favourite merge tool'.

3

Re: Authorization on a site with jsp

Hello, zoom-zoom, you wrote: to use AngleSharp http://ru.stackoverflow.com/questions/5 … 851#587851 There by the way there is support JS https://github.com/AngleSharp/AngleSharp/wiki/Examples easier

4

Re: Authorization on a site with jsp

Hello, Serginio1, you wrote: S> to use AngleSharp http://ru.stackoverflow.com/questions/5 … 851#587851 S> There by the way there is support JS S> https://github.com/AngleSharp/AngleSharp/wiki/Examples By the way in a subject - in AngleSharp rather brake css query engine (in comparison with CsQuery and-or  the browser) easier.

5

Re: Authorization on a site with jsp

Hello, fddima, you wrote: F> Hello, Serginio1, you wrote: S>> to use AngleSharp http://ru.stackoverflow.com/questions/5 … 851#587851 S>> There by the way there is support JS S>> https://github.com/AngleSharp/AngleSharp/wiki/Examples F> By the way in a subject - in AngleSharp rather brake css query engine (in comparison with CsQuery and-or  the browser) easier. Giving is not present. There from the version to the version all faster. The main expenses it is data acquisition from the server.

6

Re: Authorization on a site with jsp

Hello, Serginio1, you wrote: F>> By the way in a subject - in AngleSharp rather brake css query engine (in comparison with CsQuery and-or  the browser). S> Giving is not present. There from the version to the version all faster. The main expenses it is data acquisition from the server. It already at whom as. At me performance css query engine rather scrupulous place. All right, it .

7

Re: Authorization on a site with jsp

8

Re: Authorization on a site with jsp

Hello, fddima, you wrote: F> Hello, Serginio1, you wrote: F>>> By the way in a subject - in AngleSharp rather brake css query engine (in comparison with CsQuery and-or  the browser). S>> Giving is not present. There from the version to the version all faster. The main expenses it is data acquisition from the server. F> it already at whom as. At me performance css query engine rather scrupulous place. All right, it . Thanks, I will understand with . Programs.

9

Re: Authorization on a site with jsp

10

Re: Authorization on a site with jsp

Hello, zoom-zoom, you wrote: you Take in hands  and you compare

11

Re: Authorization on a site with jsp

Hello, Serginio1, you wrote: S> Hello, zoom-zoom, you wrote: S> you Take in hands  and you compare Thanks, downloaded Fiddler, I will understand now with it.