Click here to hide categories Click here to show left categories

User: Home          welcome : Guest          Log In / Register here     




Unsafe code Example in .net

If you try to run a website with unsafe code (Like pointers) in Asp.net website then compiler will give a compilation error while compiling site i.e. "Unsafe code may only appear if compiling with /unsafe".

Solution is: You have to tell the compiler to allow the unsafe code in code. To do that Write in web.config

compilerOptions="/unsafe" under  

Full line code is given below:


   
    extension=".cs" compilerOptions="/unsafe"
      
   


Microsoft supplies a utility called PEVerify.exe, which examines all of an assembly's methods and notifies you of any methods that contain unsafe code. This will let you know if there may be Problems running your application via the intranet or Internet
Share this article   |    Print    |    Article read by 4203 times
Author:
Rohit kakria
I am software developer
Related Articles:
Related Interview Questions: