I'm trying to create an action on a controller which takes a domain-qualified username as an argument.
public class AccountsController : ApiController
{
[HttpGet, Route("accounts/{username}")]
public IHttpActionResult Get(string username)
{
return Ok();
}
}
I can perform an HTTP GET /accounts/test%40testing
and get the OK response back.
When I try to make a similar request with a qualified username, the action on the controller isn't hit; HTTP GET /accounts/user%40testing.org
gets a 404 response. I can see the request entering the application's OWIN middleware, so I'm confident it's making it out of the host into the .NET code.
I'm assuming there's something special about the way Web API handles these values, but I can't find anything in the MSDN documentation or a hint on how to handle this.
How can I get these values passed into the action?