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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:35:08+00:00 2026-05-26T22:35:08+00:00

I have an extension method on HttpRequest that I’m trying to use inline on

  • 0

I have an extension method on HttpRequest that I’m trying to use inline on different aspx pages.

Despite I’ve added the correct import to the aspx I get an error saying that the method doesn’t exist. The extension method works perfect on code behind.

Compiler Error Message: CS0117: ‘System.Web.HttpRequest’ does not contain a definition for…

In order to fix this, I had to add this web.config declaration

<system.codedom>
  <compilers>
    <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider,System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
      <providerOption name="CompilerVersion" value="v3.5"/>
      <providerOption name="WarnAsError" value="false"/>
    </compiler>
  </compilers>
</system.codedom>

I found that here but I have no idea why I need this declaration.

I’m not sure what’s for and I’m concerned that it might have some side effect.

Do you know why I need this declaration and how I could avoid it?

  • 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-26T22:35:09+00:00Added an answer on May 26, 2026 at 10:35 pm

    Extension methods were introduced in .NET 3.5. By default, inline code is compiled with CompilerVersion v2.0. You need to add the block you specified to instruct the runtime to compile language features introduced in .NET 3.5, hence the CompilerVersion value of “v3.5”.

    The problem is specific to ASP.NET, as extension methods compile in normal applications under the CLR 2.0 compiler.

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

Sidebar

Related Questions

I have an extension method that I wrote but when I use it on
I have an extension method which I can use from the .cs codebehind of
I have a HtmlHelper extension method that I would like to apply some logic
I want to have an extension method for XElement/XAttribute that allows me to apply
I have an extension method for the DateTime type that I would like to
So I have an extension method for the Html.CheckBoxFor() method that enables the user
I have an extension method that looks like the following: //[MethodImpl(MethodImplOptions.NoOptimization)] public static IEnumerable<char>
I have an extension method that asserts a given value is one of the
I have this extension method I use in WinForms but would like to know
I have an extension method that I would like to overload so it can

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.