像网页一样在C#中发送POST请求吗? [英] Send POST request in C# like a web page does?

查看:163
本文介绍了像网页一样在C#中发送POST请求吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
如何模拟浏览器的HTTP POST请求和在C#中捕获结果

Possible Duplicate:
How to simulate browser HTTP POST request and capture result in C#

我的网页中有以下表格...

I have the following form in my web page...

<input type="text" tabindex="1" id="username" name="username" size="30"/>
<input type="password" tabindex="2" id="password" name="password" size="30"/>

我使用这些登录我的网站.
但是我也想在我的应用程序中提供此功能.
如何使用HTTP Web请求将用户名和密码发送到我的验证页面?

I use these to log into my website.
But I want to provide this functionality in my application as well.
How do I use a HTTP web request to send the user and password to my verification page?

推荐答案

斯科特·汉瑟曼(Scott Hanselman)对此发表了精彩的文章:

Scott Hanselman has a great post about this:

http://www.hanselman.com/blog/HTTPPOSTsAndHTTPGETsWithWebClientAndCAndFakingAPostBack.aspx

(非常类似于@The Mask响应,但解释上有些冗长)

(quite similar to @The Mask response, but a bit more verbose on the explanation)

这篇关于像网页一样在C#中发送POST请求吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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