0

I'm sending data to my web API using postman via body-> form-data

this is my code

public class get_CustomerSignIn
{       
        public string mobile { get; set; }   
        public string password { get; set; }
} 

AND

public HttpResponseMessage Post(get_CustomerSignIn Gsign)
{
string mobile = Gsign.mobile;
string password = Gsign.password;
        
.......etc
        
        
}

in this case I'm getting error my model objects are null, but while posting using body->raw->json in postman its working

Simply my question is how can I get form-data into my model objects directly.? (I cant change post type into to x-www-form-urlencoded )

1 Answer 1

1

You can get form data value by using below code:

HttpContext.Current.Request.Form["Your key"];
Sign up to request clarification or add additional context in comments.

1 Comment

but in this case we want to assign this value again to my class object, thank you for your reply, i found the solution, using API MULTIPART FORMDATA FORMATER package

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.