Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2014
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.23 KB | None | 0 0
  1. if (IsLogin)
  2. {
  3. HttpWebResponse RedirectResponse = RedirectToUrl("https://services.test.com/Pages/Trans.aspx");
  4.  
  5. Stream streamResponse = RedirectResponse.GetResponseStream();
  6. StreamReader streamRead = new StreamReader(streamResponse);
  7. outString = streamRead.ReadToEnd();
  8.  
  9. System.Collections.ArrayList strAccountList = GetListByID("ctl00_PlaceHolderMain_AccountsDDL_ddlAccounts");
  10. for (int intAccountCount = 0; intAccountCount < strAccountList.Count; intAccountCount++)//Here all data from ddl all good
  11. {
  12. string[] strAcctList = strAccountList[intAccountCount].ToString().Split('t');
  13. string strAccountNumber = strAcctList[0];
  14.  
  15. PostString += "__EVENTVALIDATION=" + GetValueByID(LoginInfo, "__EVENTVALIDATION") + "&";
  16. PostString += "ctl00$PlaceHolderMain$AccountsDDL$ddlAccounts=" + strAccountNumber + "&";//This have to change the option
  17.  
  18. HttpWebRequest postRequest = (HttpWebRequest)WebRequest.Create("https://services.bankjerusalem.co.il/currentaccount/Pages/current.aspx");
  19.  
  20. postRequest.CookieContainer = new CookieContainer();
  21. postRequest.CookieContainer = _cookies;
  22. postRequest.Method = WebRequestMethods.Http.Post;
  23. postRequest.UserAgent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)";
  24. postRequest.AllowWriteStreamBuffering = false;
  25. postRequest.ProtocolVersion = HttpVersion.Version11;
  26. postRequest.AllowAutoRedirect = false;
  27. postRequest.ContentType = "application/x-www-form-urlencoded";
  28.  
  29. byte[] byteArray = Encoding.ASCII.GetBytes(PostString);
  30. postRequest.ContentLength = byteArray.Length;
  31. Stream newStream = postRequest.GetRequestStream();
  32. newStream.Write(byteArray, 0, byteArray.Length);
  33. newStream.Close();
  34.  
  35. HttpWebResponse postResponse = (HttpWebResponse)postRequest.GetResponse();
  36. outString = "";
  37. Stream streamResponseLoginForm = postResponse.GetResponseStream();
  38. StreamReader streamReadLoginForm = new StreamReader(streamResponseLoginForm);
  39. outString = streamReadLoginForm.ReadToEnd();//Here i can see that data is not changed
  40.  
  41.  
  42. if (outString == null)
  43. {
  44. LogOut();
  45. }
  46.  
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement