Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8436257
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T07:07:58+00:00 2026-06-10T07:07:58+00:00

I have correctly implemented authentication on an MVC application I have been working on

  • 0

I have correctly implemented authentication on an MVC application I have been working on and would like some suggestions on the possibilty of showing different master layout pages for the different user roles.

My system currently has (and will probably always have) 3 user roles:

1. Administrator
2. Superior
3. General

What I would like to do is create 3 user layouts based on their role (after first being pointed to a login page) so _layout_admin.vbhtml etc

Does anyone know how this can be achieved? I have searched all over and know I can limit controllers but want to redirect them first to their correct user layout.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T07:08:00+00:00Added an answer on June 10, 2026 at 7:08 am

    In your ~/Views/ViewStart.cshtml:

    @Code
        Dim r = Roles.GetRolesForUser()
        If r.Contains("Administrator") Then
            Layout = "~/Views/Shared/_LayoutForAdmin.vbhtml"
        ElseIf r.Contains("Superior") Then
            Layout = "~/Views/Shared/_LayoutForSuperior.vbhtml"
        ElseIf r.Contains("General") Then
            Layout = "~/Views/Shared/_LayoutForGeneral.vbhtml"
        Else
            Layout = "~/Views/Shared/_Layout.vbhtml"
        End If
    End Code
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have implented some lovely forms authentication in ASP.NET MVC 3, this has been
I would like to implement single sign-on (sso) in a management application we have
I have implemented correctly bump's api, and added this code: - (void) configureBump {
I implemented HTTP digest authentication in my CherryPy application using the built-in tools.auth_digest tool.
I have implemented SSO authentication using the sourceforge spnego project . This is my
Here is what I am trying to do: I have implemented Form Authentication in
This is not an MVC topic. I have an ASP.NET Application which performs URL
I have a classic ASP application currently secured using ASP.NET Forms Authentication running on
I'm wanting to change our c# asp.net mvc application to work with windows authentication
Having just implemented this, I have a pretty basic question about how authentication and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.