Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/260.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何以编程方式调用示例网页上的按钮_C#_.net_Httpwebrequest_Http Post - Fatal编程技术网

C# 如何以编程方式调用示例网页上的按钮

C# 如何以编程方式调用示例网页上的按钮,c#,.net,httpwebrequest,http-post,C#,.net,Httpwebrequest,Http Post,我在网页上也做过类似的尝试。我的意思是,在web页面上,我单击按钮,post事件从asp页面请求我的查询结果 在这里,我以编程的方式尝试它 string paramaters = "sql=select+%2A+from+hsp%5Fistanbul+u+where+u%2Ehsp%5Fhosdere%5Fno+%3D+28960099"; string strResponse; HttpWebRequest requestLogin = (HttpWebRequest)WebRequ

我在网页上也做过类似的尝试。我的意思是,在web页面上,我单击按钮,post事件从asp页面请求我的查询结果

在这里,我以编程的方式尝试它

string paramaters = "sql=select+%2A+from+hsp%5Fistanbul+u+where+u%2Ehsp%5Fhosdere%5Fno+%3D+28960099";
    string strResponse;

HttpWebRequest requestLogin = (HttpWebRequest)WebRequest.Create("http://10.1.20.39/query/query.asp");
requestLogin.Credentials = new NetworkCredential("xyz", "tyewrrf"); 
requestLogin.Method = "POST"; 
 requestLogin.ContentType = "application/x-www-form-urlencoded"; 
requestLogin.ContentLength = paramaters.Length; 
StreamWriter stOut = new StreamWriter(requestLogin.GetRequestStream(), System.Text.Encoding.ASCII);
stOut.Write(paramaters); 
stOut.Close();
HttpWebResponse responseLogin = (HttpWebResponse)requestLogin.GetResponse(); 
StreamReader stIn = new StreamReader(responseLogin.GetResponseStream());
strResponse = stIn.ReadToEnd();// here I want to get the the same html codes as if I do click on the web page...
stIn.Close();  

考虑使用?

参数是不合适的,这就是为什么我使用firebug查看post数据。然后它就开始工作了