How can I store a useful value in my ASP.NET MVC site's URL and make it propagate?
- by joshjs
Let's say I have a simple ASP.NET MVC site with two views. The views use the following routes: /Foo and /Foo/Bar.
Now let's say I want to use the URL to specify (just for the sake of example) the background color of the site. I want my routes to be, for instance, /Blue/Foo or /Green/Foo/Bar.
Also, if I call Html.ActionLink from a view, I want the Blue or Green value to propagate. So, e.g., if I call Html.ActionLink("Bar", "Foo") from /Blue/Foo, I want /Blue/Foo/Bar to come back.
How best can I do this?
(Forgive me if I'm missing an existing post. This is hard for me to articulate concisely, so I'm not quite sure what to search for.)