例如,另一个站点执行以下操作:
string url = "https://mvc2-site.com/TestReceive"; // that's my site's controller action
NameValueCollection inputs = new NameValueCollection();
inputs.Add("SessionId", "11111");
System.Net.WebClient Client = new WebClient();
byte[] result = Client.UploadValues(url, inputs);
我如何在我的网站上收到那个帖子?我试过:
public ActionResult TestReceive(FormCollection fc) {} // doesn't get hit
public ActionResult TestReceive(string SessionId) {} // method gets hit but session id is null
public ActionResult TestReceive()
{
var param = ControllerContext.RouteData.Values["parameter"].ToString(); // Values["parameter"] is null
}
我不控制其他网站,它必须是一个职位(不是一个网站服务或其他任何东西)
作为另一个转折点,它们将发布大约10个变量,但有些变量是可选的,因此它们可能不在POST数据中。