Xpode.com        Click here to Print this article.

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



Contributed by:
Rohit kakria
I am software developer

Resourse address on xpode.com

Click here to go on website