URL-Encoded post parameters don't Bind to model
- by Steven Klein
I have the following Model
namespace ClientAPI.Models {
public class Internal {
public class ReportRequest {
public DateTime StartTime;
public DateTime EndTime;
public string FileName;
public string UserName;
public string Password;
}
}
}
with the following method:
[HttpPost]
public HttpResponseMessage GetQuickbooksOFXService(Internal.ReportRequest Request){
return GetQuickbooksOFXService(Request.UserName,
Request.Password, Request.StartTime, Request.EndTime, Request.FileName);
}
My webform looks like this:
<form method="POST" action="http://localhost:56772/Internal/GetQuickbooksOFXService" target="_blank">
<input type="text" name="StartTime" value="2013-04-03T00:00:00">
<input type="text" name="EndTime" value="2013-05-04T00:00:00">
<input type="text" name="FileName" value="Export_2013-04-03_to_2013-05-03.qbo">
<input type="text" name="UserName" value="UserName">
<input type="text" name="Password" value="*****">
<input type="submit" value="Submit"></form>
My question is:
I get into the GetQuickbooksOFXService function but my model has all nulls in it instead something useful. Am I doing something wrong?