2

I am new with Asp.net MVC and I have a problem with my designs. I have a dashboard based application so technically I always login separately from my dashboard, but when I migrate to MVC I found out that it has a layout and all views is rendered there.

My idea is to make the layout view as my dashboard,but if I do that the login will render there. How to solve this problem. This is what I want to happen to my website.

Login

separated from layout

Dashboard

The Dashboard is the layout and the content is the views except the login.

How do I do this?

2 Answers 2

3

You can have the login view use a different layout.

In the view:

@{
    Layout = "~/Views/Shared/non-dashboard-layout.cshtml";
}

This layout would be different to the dashboard layout.

Sign up to request clarification or add additional context in comments.

1 Comment

1. Create a new layout in the ~/Views/Shared folder of the project. 2. The code to specify the layout goes at the top of your Login view (e.g. Login.cshtml).
2

You can either set the layout for login page null like this :

@{Layout = null;}

or create another layout in your Layouts folder and assign that to your login page

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.