惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
S
SegmentFault 最新的问题
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Attack and Defense Labs
Attack and Defense Labs
F
Full Disclosure
Vercel News
Vercel News
N
News | PayPal Newsroom
The GitHub Blog
The GitHub Blog
H
Hacker News: Front Page
H
Heimdal Security Blog
P
Privacy International News Feed
博客园 - 司徒正美
Google DeepMind News
Google DeepMind News
N
Netflix TechBlog - Medium
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
C
Cisco Blogs
L
Lohrmann on Cybersecurity
D
Docker
Recent Announcements
Recent Announcements
Security Archives - TechRepublic
Security Archives - TechRepublic
人人都是产品经理
人人都是产品经理
C
CXSECURITY Database RSS Feed - CXSecurity.com
P
Proofpoint News Feed
T
Tailwind CSS Blog
C
Check Point Blog
博客园 - 叶小钗
Google Online Security Blog
Google Online Security Blog
Martin Fowler
Martin Fowler
Stack Overflow Blog
Stack Overflow Blog
博客园 - 聂微东
S
Secure Thoughts
博客园 - Franky
博客园_首页
阮一峰的网络日志
阮一峰的网络日志
P
Palo Alto Networks Blog
Latest news
Latest news
量子位
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园 - 三生石上(FineUI控件)
The Cloudflare Blog
Last Week in AI
Last Week in AI
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Cyberwarzone
Cyberwarzone
小众软件
小众软件
Cisco Talos Blog
Cisco Talos Blog
Hacker News: Ask HN
Hacker News: Ask HN
T
Threatpost
T
Tenable Blog
P
Privacy & Cybersecurity Law Blog
WordPress大学
WordPress大学

博客园 - 多米诺

IIS W3SVC 无法启动1068错误的解决 Windows 10 自动升级画面 国内网站常用的一些 CDN 公共库加速服务 WebBrowser与IE的关系,如何设置WebBrowser工作在IE9、10、11模式下? [转]Windows 8.1删除这台电脑中视频/文档/下载等六个文件夹的方法 VS2013无法链接到TFS(Visual studio online),错误TF31001,TF31002 WP8 对音视频格式支持的完整说明 sprintf_s的教训 硬盘崩溃之后 MSDN Windows 下载 12 Source Code Profilers for C & C++ [转].NET Logging Tools and Libraries Qt 4.7 在VS2010环境下的编译 [原创]采用SocketAsyncEventArgs实现异步UDP收发 [转]合约程序员——中小型企业信息化的最佳选择 [转]高可用高性能计算机系统配置与调谐的基本策略 2008在网络的边缘到达了 .Net framework 3.5 无法安装,附解决方法 查找重复的美女图片 :-)
HttpWebRequest的使用方法
多米诺 · 2009-03-24 · via 博客园 - 多米诺

需要在WinForm里调用一个url发送短信,为了防止自己忘记,特将HttpWebRequest的使用方法摘录如下:

 1        public void SendSms(string phoneNumber, string text)
 2        {
 3            string url;
 4            url = string.Format(@"http://a.b.c.d/path/?user=username&password=password&phonenumber={0}&text={1}&charset=gb2312", phoneNumber, HttpUtility.UrlEncode(text));
 5
 6            HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);
 7
 8            request.MaximumResponseHeadersLength = 10240;
 9            request.Credentials = CredentialCache.DefaultCredentials;
10            request.Method = "GET";
11            request.Timeout = 60000;
12            WebResponse webRep = request.GetResponse();
13
14            Debug.WriteLine(webRep.Headers.ToString());
15            Debug.WriteLine(webRep.ResponseUri.OriginalString);
16
17            读取网页内容/不需要
43
44            // Release the resources of response object.
45            webRep.Close();
46
47        }

posted @ 2009-03-24 15:31  多米诺  阅读(1550)  评论(0)    收藏  举报

刷新页面返回顶部