I have a client that is sending me a query string where several of the parameters begin with a dollar ($
) sign. I can't start my parameters' names in C# with $
, which means that the values are not mapping when my action is being called.
Before anyone asks, no I cannot have the client change the name of the query string.
I have a feeling I'm going to have to write some sort of custom action filter to find these parameters, rename them and then pass them on to the correct action. But, before I did all that, I wanted to post the question here to see if there's a solution I'm missing.
Thanks!
This is how I handled the issue:
[HttpGet, Route("myResource")]
public virtual IHttpActionResult GetThings()
{
var query = HttpUtility.ParseQueryString(Request.RequestUri.Query);
var queryParam = query["$myParam"];
return Ok();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With