Код: Выделить всё
~/Views/_ViewStart.cshtml like so
@{
Layout = ViewContext.ViewBag.MyConfig.ThemeName;
}
Код: Выделить всё
~/Views/Emails/_ViewStart.cshtml
Код: Выделить всё
@{ Layout = null; /* Overrides the Layout set for regular page views. */ }
Код: Выделить всё
dynamic email = new Email(""); // this is in folder ~/Views/Emails/
email.To = to;
.... other fields....
email.Send();
Код: Выделить всё
Layout = ViewContext.ViewBag.MyConfig.ThemeName;
Cannot perform runtime binding on a null reference
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: Cannot perform runtime binding on a null reference
Source Error:
Line 1: @{
Line 2: Layout = ViewContext.ViewBag.MyConfig.ThemeName;
Line 3: }
Подробнее здесь: https://stackoverflow.com/questions/169 ... -subfolder
Мобильная версия