Http : POST passing data with RESTSHARP

I'm trying to get a response from an page that i make i request passing the inputs arguments which the form need using RestSharp:

the webpage form is:

 <form name="aspnetForm" method="post" action="Login.aspx?ReturnUrl=%2fUniversusNet%2fNotasFaltasTotais.aspx" onsubmit="javascript:return WebForm_OnSubmit();" id="aspnetForm"> <input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value=""> <input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value=""> <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTE4NzU1ODgxNTkPZBYCZg9kFgICAw9kFgICCQ9kFgICAQ9kFgICAQ9kFgICAQ8QZGQWAGQYAQU2Y3RsMDAkRm9ybXVsYXJpb0NvbnRlbnRQbGFjZUhvbGRlciRFc3RhZG9UZWxhTXVsdGlWaWV3Dw9kZmT14eU493cBliuPCSv6TJQbGDKjrA=="> <input type="hidden" name="__VIEWSTATEGENERATOR" id="__VIEWSTATEGENERATOR" value="7C9DFC57"> <input name="ctl00$FormularioContentPlaceHolder$UsuarioTextBox" type="text" id="ctl00_FormularioContentPlaceHolder_UsuarioTextBox" class="caixaTexto"> <input name="ctl00$FormularioContentPlaceHolder$SenhaTextBox" type="password" id="ctl00_FormularioContentPlaceHolder_SenhaTextBox" class="caixaTexto"></td> <input type="submit" name="ctl00$FormularioContentPlaceHolder$EntrarButton" value="Entrar" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&quot;ctl00$FormularioContentPlaceHolder$EntrarButton&quot;, &quot;&quot;, true, &quot;&quot;, &quot;&quot;, false, false))" id="ctl00_FormularioContentPlaceHolder_EntrarButton" class="botao">&nbsp; <a href="EsqueceuSenha.aspx" id="ctl00_FormularioContentPlaceHolder_LinkExibeEsqueceusenha" class="link">Esqueceu sua senha?</a></td> </form> 

And the below is my code until now.

 var client = new RestClient("http://ift.tt/1NSzp3d;); var request = new RestRequest("/resource/", Method.POST); request.AddParameter("__EVENTTARGET", ""); request.AddParameter("__EVENTARGUMENT", ""); request.AddParameter("__VIEWSTATE", "/wEPDwULLTE4NzU1ODgxNTkPZBYCZg9kFgICAw9kFgICCQ9kFgICAQ9kFgICAQ9kFgICAQ8QZGQWAGQYAQU2Y3RsMDAkRm9ybXVsYXJpb0NvbnRlbnRQbGFjZUhvbGRlciRFc3RhZG9UZWxhTXVsdGlWaWV3Dw9kZmT14eU493cBliuPCSv6TJQbGDKjrA=="); request.AddParameter("__VIEWSTATEGENERATOR", "7C9DFC57"); request.AddParameter("ctl00$FormularioContentPlaceHolder$UsuarioTextBox", "aaaaaaaa"); request.AddParameter("ctl00$FormularioContentPlaceHolder$SenhaTextBox", "aaaaa"); request.AddParameter("ctl00$FormularioContentPlaceHolder$EntrarButton", "Entrar"); WebProxy p = new WebProxy("https://aaaa:aaaa", true); p.Credentials = new NetworkCredential("aaaaa", "aaaaaa"); WebRequest.DefaultWebProxy = p; client.Proxy = p; IRestResponse response = client.Execute(request); var content = response.Content; richTextBox1.Text = content.ToString(); 

The code is executed with success but dont return anything: what i missing??

by TCPII via /r/csharp

Leave a Reply