Get source code of my published ASP.NET website from server

Hellcat8 picture Hellcat8 · Jan 6, 2017 · Viewed 9.7k times · Source

I've published my ASP.NET website to my Windows Server 2012 via Visual Studio.

But things happened, and I lost all of my sources. I had a backup but it is not recent enough. I could re-code everything that is missing but I don't remember all of it.

I was wondering if it's possible to get the source code from the server where I published my website ? I have a full access on it.

Thanks,

Hellcat8

Answer

Nathangrad picture Nathangrad · Jan 6, 2017

Sorry to hear that!
An ASP.NET (WebForms) application consists of code-behind classes and .aspx pages. All the code-behind classes are compiled into a class library located in the bin folder in the root directory.
An ASP.NET (MVC) application has a similar structure, but with views instead with the .cshtml / .vbhtml extension(s).

If you've lost the back-end code for the application, you'll need to decompile the dll file to obtain your code back. Sadly, you'll lose all of the code comments so they'll need to be re-created.

Some decompilers: dotPeek, ILSpy, JustDecompile, Reflector