Sunday, August 12, 2007

Unsafe code in ASP.net

Normally if we want to write unmanaged code on .net application, we have to compile the application with /unsafe option in compiler parameters. But this scenario will not work for the web application. For web application we have to specify this explicitly in the web.config.
   
<compilation defaultLanguage="c#" debug="true">
      <compilers>
        <compiler language="c#;cs;csharp" extension=".cs" compilerOptions="/unsafe" type=" Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
      </compilers>
    </compilation>

it must be placed under <system.web> section.

0 comments: