2012-08-31 58 views
0

我想要一个HTTP请求到Web服务器 - 我想激活该链接制作一个HTTP的Web请求 - asp.net

http://webserver/cgi-bin/fccgi.exe?w3exec=web.programname&w3serverpool=fcserverpool&optid=headline 

它不可能是一个超链接,因为我不希望页面去任何地方只是向该服务器发出请求/

这是通过httpwebrequest完成的吗? ...谁知道在asp.net(VB)一个很好的例子

致谢,

回答

2

是的,就做这样的事情:

HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://webserver/cgi-bin/fccgi.exe?w3exec=web.programname&w3serverpool=fcserverpool&optid=headline"); 
HttpWebResponse response = (HttpWebResponse)request.GetResponse(); 

using (response) { 
    StreamReader reader = new StreamReader(response.GetResponseStream()); 

    reader.ReadToEnd(); 
} 
0

我相信你正在寻找WebClient类。

提供了通过URI标识的资源发送数据和接收数据的常用方法。

WebClient client = new WebClient(); 
string reply = client.DownloadString (address); 
相关问题