Passing value from action link to route constraint

280 Views Asked by At

I want to pass a value (specifically subdomain value) from action link to a custom subdomain route constraint (implementing IRouteConstraint) in such a way that the value is invisible in url. By passing the value via route value collection I couldnt be able to hide that value from url. It is always visible in url.

So how can I achieve this? Is there another way of passing data so that value is invisible?

1

There are 1 best solutions below

0
On

You could create the link to your action method with the value you need. Then in the action method grab the "hidden" value and do a redirect passing the value in a cookie/session/tempdata.

This way you can grab the info you need, and the value would not be visible in the URL you redirect to.