I've scoured up and down for the answer to what I thought would be a common problem, but haven't been able to find a solution... so here's the question:
I have the following model:
public class UserModel
{
public string userType { get; set; }
public string userName { get; set; }
public string passWord { get; set; }
public string userClaim { get; set; }
public string redirectAction { get; set; }
public string jsonWebToken { get; set; }
public string message { get; set; }
}
I'm "populating" this model in a Web API controller:
return RedirectToRoute("Default", new
{
controller = "Redirect",
action = "SsoRedirect",
method = "Get",
userType = thisUser.userType,
userName = thisUser.userName,
passWord = thisUser.passWord,
userClaim = thisUser.userClaim,
redirectAction = thisUser.redirectAction,
jsonWebToken = thisUser.jsonWebToken,
message = thisUser.message,
});
Then passing it to another controller like so:
[HttpGet]
[Route("SsoRedirect")]
public IHttpActionResult SsoRedirect(UserModel myUser)
{
....
}
THE PROBLEM: myUser is coming through as null. None of the properties on the model are being bound.
Here's what I've made sure of:
- My routing is good, because a breakpoint in the SsoRedirect is in fact being hit.
- When I do a trace in fiddler I can see all the appropriate query string params being passed.
- I understand that I can't pass complex objects with Enums and other complex data types so everything is limited to strings.
So... For the life of me I can't figure out why the model isn't binding and hoping for some help here.