如何處理這個發布請求,我有一個發布資料的頁面
https://localhost:80/Test/[email protected]
我在控制器中創建了一個函式來處理類物件中的資料,但它始終為空
public ActionResult ValidateZeroBounce(ClientInfo Model)
{
}
public class ClientInfo
{
public string Email { get; set; }
public string EmailJoint { get; set; }
}
我如何處理這個值?
uj5u.com熱心網友回復:
將此添加到啟動
services.Configure<ApiBehaviorOptions>(options =>
{
options.SuppressInferBindingSourcesForParameters = true;
});
那么你可以使用這個語法
https://localhost/Test/[email protected]
或者你可以試試這個,但在這種情況下它沒有多大意義
https://localhost/Test/[email protected]
或者如果您使用舊版本的網路,這樣做更容易
public ActionResult ValidateZeroBounce(string email, string emailJoint)
{
var model= new ClientInfo {Email=email, EmailJoint=emailJoint};
....
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/443828.html
標籤:C# asp.net-mvc
上一篇:<label>元素拆分為多行
