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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T00:49:52+00:00 2026-06-03T00:49:52+00:00

In Razor, I have a few that’s located in ~/areas/shared/views/shared/_partialName.cshtml . If I do

  • 0

In Razor, I have a few that’s located in "~/areas/shared/views/shared/_partialName.cshtml". If I do simply @{ Html.RenderPartial("_partialName", myModel"); } in my view, it cannot find it. I instead have to fully qualify the path to that partial.

Can I tell my project to include the folder "~/areas/shared/views/shared/" in the list of folders it crawls when trying to find partials? This way I can keep the snippet of code in my view to render that partial nice and short. Thanks!

  • 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-03T00:49:54+00:00Added an answer on June 3, 2026 at 12:49 am

    The RazorViewEngine class contains properties which have patterns for where it should look for various view files – areas, partials, everything. You can override it pretty easily and tell your application in Globals.asax to use your implementation instead:

    public class MyViewEngine : RazorViewEngine
    {
        public MyViewEngine()
        {
            // Use the standard partials location in addition to this location
            // {0} is the partial view name, {1} is the controller name
            String[] morePartialLocations = new String[] {
                "~/areas/shared/views/shared/{0}.cshtml"
            };
            PartialViewLocationFormats =
                PartialViewLocationFormats.Concat(morePartialLocations).ToArray();
        }
    }
    
    // in Globals.asax
    
    protected void Application_Start()
    {
        ...
        ViewEngines.Engines.Clear();
        ViewEngines.Engines.Add(new MyViewEngine());
        ...
    }
    

    Note that since it sounds like you’re working with Areas, there’s another property that you can override called AreaViewLocationFormats which you can update in the same manner and insert “{2}” as the name of the area.

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

Sidebar

Related Questions

I have written a few razor helpers and these helpers use functions that include
I have a few Razor pages with lots of conditional logic, loops, partial views
I have the following razor template html, although I can't figure out how to
I have an odd problem with one of my Razor views in an ASP.NET
I have a site search (using Examine & Razor) that breaks if a space
Is it possible to render Razor in Html.Raw()? I have a dynamic page being
I have a razor view with a BeginForm command and a loop within that
I have this Razor Template <table> <tr> <td>@Html.RadioButtonFor(i => i.Value, 1)</td> <td>@Html.LabelFor(i => i.Value,
Possible Duplicate: Emitting unencoded strings in a Razor view I have a string that
With ASP.NET MVC3 (Razor) I have a simple page that loads a jQuery UI

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.