If you debug your code you will find out that you set
Layout depending on the controller configuration.
So far so good.
Then you replace
Layout with
layout which was set to an empty string before.
Please try this:
@{
var controller = HttpContext.Current.Request.RequestContext.RouteData.Values["Controller"].ToString();
if(controller == "Admin")
{
Layout = "~/Views/Shared/_Layout.cshtml";
}else
{
Layout = "~/Views/Shared/_Layout.cshtml";
}
}