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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T17:26:28+00:00 2026-06-08T17:26:28+00:00

Today, I found a very nice feature giving me the ability to add cshtml

  • 0

Today, I found a very nice feature giving me the ability to add cshtml helper. To be able to do that, I must put cshtml file in a folder named ‘App_Code’ and then adding into a code that looks like that:

@using System.Security.Policy

@helper jQuery(){
   if (System.Diagnostics.Debugger.IsAttached)
   {
        <script src="@Url.Content("~/Scripts/JQuery/jquery-1.7.2.js")" type="text/javascript"></script>
   }
   else
   {
        <script src="@Url.Content("~/Scripts/JQuery/jquery-1.7.2.min.js")" type="text/javascript"></script>
   }
}

The problem is immediatly after adding this folder with just one file, when I try to access page in browser, I receive a server error.

“NetworkError: 500 Internal Server Error – http://localhost/%5BPort%5D&#8230;

I already have code into other folders of my project.

Must I have to move all my code into the ‘App_Code’ folder or is there any trick to keep my existing structure but with this new ‘App_Code’ folder?

Thank you.

  • 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-08T17:26:29+00:00Added an answer on June 8, 2026 at 5:26 pm

    You can’t use helpers within the helper so they are not as helpful as you might have initially thought 🙂

    Things like Html and Url don’t exist within those helper functions. So if you need to use them, you will have to pass them as parameters:

    @using System.Web.Mvc
    @using System.Security.Policy
    
    @helper jQuery(UrlHelper urlHelper)
    {
       if (System.Diagnostics.Debugger.IsAttached)
       {
            <script src="@urlHelper.Content("~/Scripts/JQuery/jquery-1.7.2.js")" type="text/javascript"></script>
       }
       else
       {
            <script src="@urlHelper.Content("~/Scripts/JQuery/jquery-1.7.2.min.js")" type="text/javascript"></script>
       }
    }
    

    and when calling pass the instance of the current UrlHelper to it:

    @Foo.jQuery(Url)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Today I found a very mysterious bug in the code. I have used the
Today I found LiquiBase project and I think it is very interesting. I would
Today I found that my site was down...I turned the errors to off and
I was looking at a css file today and found the following rule set:
Today, I found out that you can write such code in C++ and compile
Today I found this query in our code that pulls up a list of
I found something very odd today: If you create objects with a constructor function
I found a very strange bug with Firebreath today. I was trying to compile
I tried Build and Analyze tool of Xcode very first time today. and found
I've made a very small ruby script today that makes use of regexes to

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.