Using MVC 3 Razor, how can I specify a variable in a call to @Url.Content() .
@Url.Content()
Example:
@{ var myVar = Request.QueryString["foo"]; } <a href="@Url.Content("~/bar?@myvar")">click here</a>
At this point, you are already in the context of C #, so you can use the variable just like in the code file. Try the following:
<a href="@Url.Content("~/bar?" + myvar)">click here</a>