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 7689229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:06:56+00:00 2026-05-31T20:06:56+00:00

I have controller PlayerController and actions inside: View , Info , List . So

  • 0

I have controller PlayerController and actions inside: View, Info, List.
So on urls “/Player/View” i get result with default Layout.

I want to get result with different Layout on request “/External/View”.

How can i achieve this?

  • 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-05-31T20:06:57+00:00Added an answer on May 31, 2026 at 8:06 pm

    Although you can override the layout from the controller as has been suggested in another answer, in my opinion this means the controllers are getting just too involved in determining what the UI will be. Best to leave this purely to the Views to decide.

    The closest to what you’re asking is to do this in your current "~/Views/_ViewStart.cshtml":

    @{
      if(Context.Request.Path.StartsWith("/External", StringComparison.OrdinalIgnoreCase))
        Layout = "~/Views/_ExternalLayout.cshtml";
      else
        Layout = "~/Views/_Layout.cshtml";
    }
    

    Where "~/Views/_ExternalLayout.cshtml" is your alternative layout.

    Might want to check the leading "/" is correct on there, I can’t remember if it is.

    If you put this in the existing _ViewStart, then any view that is being rendering in response to a url starting with "/External" will use this new layout, otherwise the ‘normal’ one will be used.

    Another approach is to use the routing table to add a route value that can be used here to make a layout decision; but I’ve gone for this approach to keep it simple.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi I have a controller named places with some actions like view, new, create
I have controller which gets list of keys and i want to pass them
I have seen the sample application of iPhone MP-movie player - controller. They have
I have controller with action new , and I want it to create ActiveRecord::Base
Hi guys i have controller which returns a partial view, the controller is called
When submitting one form from view, how can i also read or have controller
I have controller action /posts/sitemap where the sitemap is generated. Now i want to
I have controller my_controller and in it the action my_action . In my_action view
In my application I have controller named Snippets both in default area (in application
I have controller action which returns JsonResult and is consumed by jquery ajax get

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.