简体   繁体   English

来自控制台应用程序C#的HTTP发布

[英]HTTP Post from Console application C#

I have web site that contains textbox and button, when enter something in the textbox and click the button the site redirect to another one. 我有一个包含文本框和按钮的网站,当在文本框中输入内容并单击按钮时,该站点将重定向到另一个。

My question is how to get the redirected URL using console application , and how to pass the textbox value. 我的问题是如何使用控制台应用程序获取重定向的URL,以及如何传递文本框值。

This article on MSDN describe how to post data using HttpWebRequest. MSDN上的本文介绍了如何使用HttpWebRequest发布数据。 Set property HttpWebRequest.AllowAutoRedirect false and process GetResponse and GetResponseStream 将属性HttpWebRequest.AllowAutoRedirect设置为false并处理GetResponseGetResponseStream

You probably would need a proxy to trap the response and then you can redirect from that proxy. 您可能需要一个代理来捕获响应,然后才能从该代理重定向。 Try using burpsuite it is a proxy which will allow you to do this. 尝试使用burpsuite,它是一个代理,可以让您执行此操作。

As I understand you need to define service that will receive a value and will return URL . 据我了解,您需要定义将接收值并返回URL的服务。 The service will be called from the web site or console application. 该服务将从网站或控制台应用程序中调用。 You can use wcf , old asmx 您可以使用wcf,旧的asmx

The value can be passed as parameter to your web method . 该值可以作为参数传递给Web方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM