通过ASP.NET C#发送HTTP请求 [英] Send HTTP Request via ASP.NET C#

查看:118
本文介绍了通过ASP.NET C#发送HTTP请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图通过发送C#HTTP GET请求。但似乎不工作。这是我的工作。我从你想,使其工作所需的更正!

 字符串移动= txt_phone.Text;
            字符串消息=您successfuly注册。
            乌里targetUri =新的URI(http://sms-om.com/smspro/sendsms.php?user=HatemSalem);
            System.Net.HttpWebRequest请求=(System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(targetUri);


解决方案

您目前还没有执行的请求,请使用:

  VAR响应= request.GetResponse()作为HttpWebResponse;

这是它实际上会从网络上获取数据,并给你任何培训相关的错误点

Am trying to send HTTP Get request via C#. But it seems not working. Here is my work. And i wanna from you the corrections needed to make it work !

            String Mobile = txt_phone.Text;
            String Message = "You have registered successfuly.";
            Uri targetUri = new Uri("http://sms-om.com/smspro/sendsms.php?user=HatemSalem");
            System.Net.HttpWebRequest request = (System.Net.HttpWebRequest) System.Net.HttpWebRequest.Create(targetUri);

解决方案

You currently haven't executed the request, use:

var response = request.GetResponse() as HttpWebResponse;

This is the point where it will actually get data from the web and give you any relevent errors

这篇关于通过ASP.NET C#发送HTTP请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆