从代码隐藏中点击外部URL

Ste*_*ven 3 c# forms asp.net httpwebrequest

我的网站上有一个表单.用户输入他们的电子邮件并从下拉列表中选择一个位置.然后,我需要通过在查询字符串中使用用户的位置和电子邮件命中URL来将该数据发布到外部站点.

我这样做是这样的:

string url = "http://www.site.com/page.aspx?location=" + location.Text + "&email=" + email.Text;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Run Code Online (Sandbox Code Playgroud)

我的客户说我没有打他们的服务器,但在通过调试器时,我收到他们服务器的响应.我还尝试使用Firebug跟踪发生的事情,我注意到没有对该外部站点进行过POST.

我在这做错了什么?

Kir*_*kar 5

    string line;
    HttpWebRequest request = WebRequest.Create("http://www.yahoo.com") as HttpWebRequest;
    HttpWebResponse response = request.GetResponse() as HttpWebResponse;
    StreamReader streamr = new StreamReader(response.GetResponseStream());
    line = streamr.ReadToEnd();
Run Code Online (Sandbox Code Playgroud)

你可以找到我已写完全文的帖子