Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9015693
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T03:48:51+00:00 2026-06-16T03:48:51+00:00

In a project I completed several months I had this in the controller: public

  • 0

In a project I completed several months I had this in the controller:

 public HttpResponseMessage Post(PersonModel model)
 {
 }

I could send the ajax post with the members inside a json object, and WebAPI would seamlessly populate each property within the model.

However, I’ve just started a new project and am doing the same but the model inside the controller is now just null. The binding appears to be broken. Has something changed on ASP.NET WebAPI that prevents this from happening?

This is my ajax request:

$.ajax({ url: "api/auth", type: "post", data: { username: "jon", password: "123" },dataType: "json", contentType: "application/json; charset=utf-8" });
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T03:48:52+00:00Added an answer on June 16, 2026 at 3:48 am

    Your ajax request content body has the format of application/x-www-form-urlencoded:
    username=jon&password=123, but you have set content-type to application/json. Because of this, Json.NET serializer failed to deserialize the request body content.

    You could do one of the following:

    1. Change the content-type to be application/x-www-form-urlencoded instead of explicitly setting the contentType to be application/json

    2. Continue to use application/json but Json stringify your data:
      data: JSON.stringify({ username: "jon", password: "123" })

    Hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have been working on a project for several months without any problems until
I've almost completed my project but just have this last thing which I've been
I've recently completed a project in Java,and showed it to my advisor. Forget about
I have completed a simple database for a project. Only 6tables. Of the 6,
I've just completed an automation script that: downloads a project build to local storage
We have just completed implementing a successful but problematic project. We want to get
I have a university project which is already 99% completed. It consists of two
I have just completed an application for my final year project and I need
After initiating a new project, I would like to know when Petrel has completed
One of my project is to download several large size files using ASIHTTPRequest in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.