Basically I want a certain layout to be used when someone is visiting the root page:
www.foo.com
And another layout when visiting anywhere else:
www.foo.com/asdf
I could use different _Layout files, but since the only change is here, I find that counterproductive.
Here's what I have tried, hopefully it illustrates what I'm trying to accomplish:
@if (HttpContext.Current.Request.Url.ToString() == "some way to check root?")
{
@RenderBody()
}
else
{
<div id="big-kahuna"> <!-- Literally the only change. -->
@RenderBody()
</div>
}
if(Request.Url.PathAndQuery == "/") // root;
if (Request.AppRelativeCurrentExecutionFilePath == "~/")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.