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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:00:27+00:00 2026-05-23T01:00:27+00:00

I have an issue with using declarative helpers in the App_Code directory. I created

  • 0

I have an issue with using declarative helpers in the App_Code directory.
I created a base webviewpage for my views, which has my localization method in it.
I also have a collection of enums to use for my helpers, which revolve around CSS names.

For instance, DataRole is an enum referring to the allowed CSS classes for display and GetStr is a method of my base class to print the localization value of the label:

@helper ReadOnlyColumns(DataRole role, string label, string contents)
{
  <div class="@role">@GetStr(label)</div>
}

My web.config has the definition for the base page type, and the correct namespaces to include. These settings work for views not in the App_Code directory.

Does anyone have any ideas how to make the App_Code directory work? Should I put a web.config inside it? I am at a loss.

I know you can do @implements and @using, and that works. But I am trying to build the foundation for our software and don’t feel it should be necessary to include things that will be used on absolutely every page we write.

Edit, this is my web.config settings in the root, and every views directory:

<configSections>
    <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
        <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
        <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
    </sectionGroup>
</configSections>

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

Thanks,

Brad

  • 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-23T01:00:28+00:00Added an answer on May 23, 2026 at 1:00 am

    Pages in App_Code are hard-coded in WebRazorHostFactory to inherit the HelperPage class.

    You cannot change that default.

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

Sidebar

Related Questions

We have an issue using the PEAR libraries on Windows from PHP . Pear
I have an issue with using AWK to simply remove a field from a
I have the following issue using java 1.4 I try to display a very
I have a strange issue: I am using SPContext.Current.Web in a .aspx page, but
I have an issue that is driving me a bit nuts: Using a UserProfileManager
I have this strange issue with my web app. You see, I'm using jQuery
I have been using PLT Scheme , but it has some issues. Does anyone
I have a strange issue that has arisen recently: Whenever I enter text, even
I have an issue using the Location Api. I'm trying to get the Location
I have and issue with using the XmlnsDefinition attribute within a silverlight 4 assembly.

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.