How to handle this post request, i have a page that posts the data like
https://localhost:80/Test/[email protected]
I have created a function in the controller which handle the data in a class object, but it remains always null
public ActionResult ValidateZeroBounce(ClientInfo Model)
{
}
public class ClientInfo
{
public string Email { get; set; }
public string EmailJoint { get; set; }
}
how I can handle that value ?
CodePudding user response:
add this to startup
services.Configure<ApiBehaviorOptions>(options =>
{
options.SuppressInferBindingSourcesForParameters = true;
});
then you can use this syntax
https://localhost/Test/[email protected]
or you can try this, but in this case it doesn't make much sense
https://localhost/Test/[email protected]
or if you use an old version net , it is easier to do this way
public ActionResult ValidateZeroBounce(string email, string emailJoint)
{
var model= new ClientInfo {Email=email, EmailJoint=emailJoint};
....
}