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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:54:04+00:00 2026-05-27T22:54:04+00:00

I have a Test.cshtml view where I have the ability to code something like:

  • 0

I have a Test.cshtml view where I have the ability to code something like:

@Url.Action(.....)

It works when the page is located under the Views folder.

It doesn’t work anymore when the page is located elsewhere like under Themes folder.

  • 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-27T22:54:05+00:00Added an answer on May 27, 2026 at 10:54 pm

    It doesn’t work anymore when the page is located elsewhere like under Themes folder.

    That’s normal. Views should be located only inside the Views folder. They have nothing to do outside it.

    The reason for this is the ~/Views/web.config file which indicates the type of all views:

    <system.web.webPages.razor>
        <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <pages pageBaseType="System.Web.Mvc.WebViewPage">
          <namespaces>
            <add namespace="System.Web.Mvc" />
            <add namespace="System.Web.Mvc.Ajax" />
            <add namespace="System.Web.Mvc.Html" />
            <add namespace="System.Web.Routing" />
          </namespaces>
        </pages>
    </system.web.webPages.razor>
    

    Notice the pageBaseType attribute? This is what indicates that a view derives from the System.Web.Mvc.WebViewPage class which defines properties such as Html and Url helpers.

    When you put a view somewhere outside the Views folder, I suppose you forgot to include such a web.config at the root so there is nothing specifying the base type of your razor pages and thus things like Url and Html helpers no longer exist.

    So one possibility is to violate all standard ASP.NET MVC conventions and copy the ~/Views/web.config file to wherever you intend to place your views.

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

Sidebar

Related Questions

Let's say i have 2 files located in the same folder. /Test/View.cshtml <h1>File that
I have a page X.cshtml with the following code: @helper CodeTest{ <h1>Test</h1> } And
Mypage.cshtml have a page and have a domain xxx.com and a subdomain test.xxx.com that
I would like to pass parameter from view to controller in cshtml page. This
I have test code as below. test1 passes the test but test2 failed when
I have test this code on my development environment (windows 7, visual studio 2010)
I have test.txt file, like this, AA=1 BB=2 CC=3 Now I wanna find BB=
I have 2 forms in my myPage.chtml page as follows: @using (Html.BeginForm(Tests1, Test, FormMethod.Post,
I made a test partial page named _Test.cshtml and put it in the same
I have a button in my .cshtml page. I want to pass the id

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.