I'm setting a class on my html tag when a specific query string argument is sent, right now I'm doing it like this (Razor view master page):
@if (HttpContext.Current.Request.QueryString.AllKeys.Contains("Foo") && HttpContext.Current.Request.QueryString["Foo"] == "Bar") {
//Do something when Foo=Bar (like http://server/route?Foo==Bar)
<html class="bar-class">
}
else {
//Normal html tag
<html>
}
Works fine for normal requests, but not when I call the page using RenderAction, like
//Other view, the one requested by the user
@Html.RenderAction("Index", "Route", new {Foo="Bar"})
After some looking around I have realized that there only is one actual HttpContext, which means that HttpContext.Current points to the first request. So - how do I get the query string data for the sub request?
Thanks! /Victor