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

  • Home
  • SEARCH
  • 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 7803935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T01:44:56+00:00 2026-06-02T01:44:56+00:00

I have a layout page in ~/Views/Shared/_Layout.cshtml and it works great for all normal

  • 0

I have a layout page in ~/Views/Shared/_Layout.cshtml and it works great for all normal views that get rendered. However, I created an area called “Demos” and in the ~/Areas/Demos/Views/_ViewStart.cshtml file I pointed it to my original layout page.

This works just fine except some calls to @Html.ActionLink() are now being prefixed with the area name. So where @Html.ActionLink("Blog", "Index", "Blog") would normally generate a link like “website.com/Blog/Index” on area views it generates “website.com/Demos/Blog/Index”.

Any ideas?

  • 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-02T01:44:59+00:00Added an answer on June 2, 2026 at 1:44 am

    To use areas open the Global.asax file and insert the following code into the Application_Start method

    AreaRegistration.RegisterAllAreas();
    

    You can link within an area as you would in any MVC application but to generate a link to a different area, you must explicitly pass the target area name in the routeValues parameter for these methods.

    @Html.ActionLink("Blog", "Index", "Blog", new { area = "blog" }, null)
    

    null parameter is required only because the ActionLink method overloads that have a routeValues parameter also have an htmlAttributes parameter but it is not required in order to be able to link between areas.

    UPDATE

    You can use RouteLink() instead of ActionLink(), to bypass the area registrations.

    @Html.RouteLink("Blog", "MyRoute", new { action = "Index", controller = "Blog" })
    

    The second parameter (“MyRoute”) is a route name registered in Global.asax so to use RouteLink() to link between different areas, you only need to specify the correct route name.

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

Sidebar

Related Questions

I have a following project structure: _ViewStart.cshtml: @{ Layout = ~/Views/Shared/_Layout.cshtml; } _Red.cshtml: @{
Here is my code: @{ ViewBag.Title = My page; Layout = ~/Views/Shared/_Layout.cshtml; } <script
I have a page layout that I use in my SharePoint solution when I
I have something like @{ Html.RenderPartial(@~/Views/Management/_Main.cshtml); } Can I change this view without page
I have a MVC 3 project in which I use _Layout.cshtml as master page
I have a shared view in my _Layout.cshtml for my header named _Header.cshtml. I
I have a custom page-library which a custom content-type and a page-layout all inside
I have a top-level _Layout.cshtml that looks something like this: <html> <head> @RenderSection(Header, required:
I have a page layout involving a lot of position absolute and z-indexing, so
I have a simple page layout with two divs--one on top, and one on

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.