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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:09:00+00:00 2026-06-18T03:09:00+00:00

Why _Layout.cshtml placed in ~/Views/Shared folder by default? I ask this question because I

  • 0

Why _Layout.cshtml placed in ~/Views/Shared folder by default?

I ask this question because I put this file in ~/Views folder and change the Layout value in the _ViewStart.cshtml

@{
    Layout = "~/views/_Layout.cshtml";
}

and it still work.

Is it for a special purpose that _Layout.cshtml placed in ~/Views/Shared folder by default?

  • 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-18T03:09:01+00:00Added an answer on June 18, 2026 at 3:09 am

    When the layout page is referenced by its full path, you are right that it makes no difference where it is, as long as it’s somewhere under the ~/Views folder.

    One situation where it would matter (but it often doesn’t), is when in your controller action you call the overload of “View()” that allows you to specify an alternate layout (master) page. If that’s the case, and the name specified is a “simple” name, such as “MobileLayout”, the default search path will be first the current controller’s view folder, and then the Shared views folder.

    Another much simpler reason is that it “makes sense” in terms of conventions, regardless of any technical requirements.

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

Sidebar

Related Questions

Problem: Given this nested layout structure: ~/Views/Shared/_layoutBase.cshtml ~/Views/Shared/_layout.cshtml Where _layoutBase.cshtml is the layout for
I have the following view: @model MyModel1 @{ ViewBag.Title = Index; Layout = ~/Views/Shared/_Layout.cshtml;
I have an Index.cshtml view: @model AttendenceModel @{ Layout = ~/Views/Shared/_Layout.cshtml; } @using (Html.BeginForm(VisOppsummering,
@{ ViewBag.Title = Index; Layout = ~/Views/Shared/_Layout.cshtml; } <h2> Index</h2> @{ using (var db
I have a following project structure: _ViewStart.cshtml: @{ Layout = ~/Views/Shared/_Layout.cshtml; } _Red.cshtml: @{
I have a layout page in ~/Views/Shared/_Layout.cshtml and it works great for all normal
I'm using MVC3 razor and in Views folder I have 4 folder: Shared _Layout.cshtml
I have put below mentioned knockout js reference inside the _Layout.cshtml file. <script src=@Url.Content(~/Scripts/knockout-2.2.0.js)
Im having some trouble getting Ajax.ActionLink to work how I expect. In /views/layout/_Layout.cshtml I
I known There is a default _Layout.cshtml file in Asp.net MVC just like MasterPage

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.