I have a regular application _Layout.cshtml and @RenderBody() to render all views inside, but only for the Login view need to be render as full page not inside @RenderBody().
Regards
I have a regular application _Layout.cshtml and @RenderBody() to render all views inside, but only for the Login view need to be render as full page not inside @RenderBody().
Regards
You need to set the Layout
property to null
at the beginning of your view.
So, your Login.cshtml
file should start with:
@model YourModel
@{
Layout = null;
}
You may not want to have no layout for your view. You probably want a custom layout (something like _LayoutFullPage.cshtml
<!DOCTYPE html>
<head>
<title>SOMETHING HERE ALONG WITH OTHER HEAD ATTRIBUTES</title>
</head>
<body>
@RenderBody()
</body>
</html>
and then use that layout in the view with
@{
Layout = "~/Views/Shared/_LayoutFullPage.cshtml";
}
Other options are to set the view as null in the cshtml (as suggested by RePierre) or to call return PartialView(model);
within your controller.