I need to pass a query string to a redirect. I know you can do this like so:
return RedirectToAction("Index", new { param1 = "hello" });
will go to /Index?param1=hello
.
But I need to pass a parameter which has a hyphen in the name. Let's call it "data-param"
. Since hyphens aren't allowed in C# names, I can't do this in the above way. I know in some places in MVC, underscores are used to handle this, but that doesn't work here either, the underscore is passed to the query string as-is.
So my question is, how do I redirect to /Index?data-param=hello
?