I have a web service written in c# and .Net, I have the following questions:
- what happens when I choose to publish the project ?
- will the code still be readable ?
- and if not, how easy it is to reverse it ?
I have a web service written in c# and .Net, I have the following questions:
what happens when I choose to publish the project ?
it compiles the project (to .dll files) and export your project to a folder
will the code still be readable ?
yes, by using Reflector
and if not, how easy it is to reverse it ?
very easy.. just install Reflector..
When you perform publish action in Visual studio or MSBuild it just compiles the code and copies it to some particular target location.
Compiling changes your readable source code to more machine readable form. In C# and other CLR based languages (i.e. VB.NET) the output is Intermediate Language (IL). This language is not as itself human readable, but it can be relative easily reverse engineered back to C# with many different tools.
When compiling happens, code will change to perform some optimations for the code, so the reverse engineered code will most likely not look exactly like the original source. Comments and other parts of the code that don't affect the execution, are removed.
There are tools to obfuscate code before it is compiled. For example dotfuscator will be shipped with the Visual Studio. Unfortunately these obfuscations can be quite easily reversed by those same tools that reverse engineer the compiled C# code.
what happens when I choose to publish the project ?
Your C# code is complied to managed DLL file which is red color box in the picture.
Only C++ can write unmanaged code which is very hard to decompile.
will the code still be readable ? and if not, how easy it is to reverse it ?
Yes, it is quite easy. You can use the following tools to decompilerthe source -
Obfuscation does not provide 100% code protection. The bottom line is do not host your web application if you do not trust the hosting service.
Credit: picture is from Illustrated C# 2012 by Daniel Solis