title: Why do I need to specify the compiler version on web.config to use extension methods inline?
body: <p>I have an extension method on HttpRequest that I'm trying to use inline on different aspx pages.</p>
  
  <p>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.</p>
  
  <blockquote>
    <p>Compiler Error Message: CS0117: 'System.Web.HttpRequest' does not contain a definition for...</p>
  </blockquote>
  
  <p>In order to fix this, I had to add this web.config declaration</p>
  
  <pre><code>&lt;system.codedom&gt;
    &lt;compilers&gt;
      &lt;compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider,System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4"&gt;
        &lt;providerOption name="CompilerVersion" value="v3.5"/&gt;
        &lt;providerOption name="WarnAsError" value="false"/&gt;
      &lt;/compiler&gt;
    &lt;/compilers&gt;
  &lt;/system.codedom&gt;
  </code></pre>
  
  <p>I found that <a href="http://www.oshyn.com/_blog/Software_Development/post/DOTNET-Extension-Methods-for-extending-classes-not-working-in-inline-code/" rel="nofollow">here</a> but I have no idea why I need this declaration.</p>
  
  <p>I'm not sure what's for and I'm concerned that it might have some side effect.</p>
  
  <p>Do you know why I need this declaration and how I could avoid it?</p>