无法从C#中的HTTP Post方法获得响应

时间:2013-08-01 11:53:31

标签: c# http-post

目标链接是 http://www.fyneworks.com/encryption/rc4-encryption/index.asp

使用LiveHttpHeaders后,我找到了参数

auth=gfmpgjixhpFhGnKFrHUmn2eHmHhigxkr&decrypt=8a+2d+2f+36
&key=102&decrypted=Paste+your+data+here

但我无法得到回应。

我使用了以下C#代码。

txtboxText.Text = txtboxText.Text.Replace(" ", "+");
WebClient client = new WebClient();
string auth = client.DownloadString("http://www.fyneworks.com/encryption/rc4-encryption/index.asp");
        string Search4This1="<input name=\"auth\" type=\"hidden\" value=\"";
        string Search4This2="\"";
        int start = auth.IndexOf(Search4This1) + Search4This1.Length;
        int end = auth.IndexOf(Search4This2, start);
        auth = auth.Substring(start, end - start);
        MessageBox.Show(auth);
        string downloadstring = client.DownloadString("http://www.fyneworks.com/encryption/rc4-encryption/index.asp?auth="+auth+"decrypted="+txtboxKey.Text.ToString()+"&key="+txtboxKey.Text.ToString());
        System.IO.File.WriteAllText(@"C:\htmlcode.txt", downloadstring);

结果:

<h2>RC4 Decryption Tool</h2>
<form class="tool" action="/encryption/rc4-encryption/index.asp" method="post">
<input name="auth" type="hidden" value="cmkGdih1ht0dGHmkIGzmlDilJJDMmTho"/>
<table width="100%" cellspacing="0">
<tr>
<td valign="middle" align="center" width="50%">
<h3>Encrypted data</h3>
<textarea name="decrypt">CC 0F 1F 0B 6A 00 5A A7 97 14 9C D7 00 76 84 27 C4 0C 73 68</textarea>
<span class="B Warning">Encoded into a <u>hexadicimal string</u></span>
</td>
<td valign="middle" align="center" width="100">
<u>Key</u>:<br/>
<input name="key" type="text" value='102' style="width:90px;"/><br/>
<input type="image" src="http://www.fyneworks.com/encryption/inc/decrypt.png" alt="ENCRYPT &raquo;"/>
</td>
<td valign="middle" align="center" width="50%">
<h3>Original data</h3>
<textarea class="result" name="decrypted"></textarea>

1 个答案:

答案 0 :(得分:0)

传递参数的方式是错误的。看看this question and answer,看看你应该如何正确地做到这一点。