.netencryptionweb-applicationssource-code-protection

Encrypt .dll from asp.net web application


I had in mind, if it´s possible to encrypt all the source code from web applications (.dll) and keep the app working with this approach?.

Recently our company has been suffering many attacks to the server, and they can be able to steal some source code and read it with reverse engineer.

So my question here is this possible?


Solution

  • I think you are just trying to protect your code from being visible on the Web Server Or probably from accessing/making modifications after deploying? You probably need to look at Publish options for .NET Web application.

    When you publish a web application, there is an option related to pre-compiling of your app. In my attached screenshot, the picture in left highlights the option on Publish setting window - "Precompile during publishing". Now, what it does - The precompiler produces assemblies from the pages. i.e. it generates the assembly (DLL) from your code-behind. At this point, your code is already converted into an assembly. You can ensure the authenticity of your assembly by signing it with a strong name.

    Advancing further, you can check the advanced properties and configure your pre-compilation. You can uncheck the checkbox "Allow pre-compiled site to be updatable"(check my attached screenshot). What it does? -

    "Compiles the .Aspx Pages, not just the code files (.VB/.CS). Leaving it checked allows you to make certain changes to the .Aspx files after it has been deployed without recompiling (ex = move the position of a control or add some additional HTML markup)."enter image description here

    Hope this helps in case if you didn't know already.