【发布时间】:2016-04-22 15:48:55
【问题描述】:
我需要将数据发布到一个 url 并重定向到相同的。目前我正在使用代码:
using (WebClient client = new WebClient())
{
byte[] response =
client.UploadValues("https://website.com/target.aspx", new NameValueCollection()
{
{ "param1", 1 },
{ "param2", 0 }
});
string result = System.Text.Encoding.UTF8.GetString(response);
}
我收到 html 字符串作为响应。我需要重定向到页面“https://website.com/target.aspx”。
【问题讨论】:
-
好的,那你可以不使用正常的重定向代码吗?我看不出你第一次发布到 URL 有什么不同。
-
Response.Redirect("https://website.com/target.aspx"); -
我需要使用 POST 请求进行重定向。 Response.Redirect 发送 GET 请求
-
将您的表单操作作为该 URL,您肯定不会为此编写代码吗? website.com/target.aspx#everytoolisahammer