How can I store a useful value in my ASP.NET MVC site's URL and make it propagate?
Posted
by joshjs
on Stack Overflow
See other posts from Stack Overflow
or by joshjs
Published on 2010-05-25T20:31:36Z
Indexed on
2010/05/25
22:41 UTC
Read the original article
Hit count: 193
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.)
© Stack Overflow or respective owner