简体   繁体   中英

ASP.NET extending application without source code

I need to extend some web application, probably in ASP.NET WebPages. Just add one function, a non-framework PHP equivalent would be uploading some newfunc.php file

It has the only one problem - I don't have no source code (tried to get it for 3 months), only access to .dlls on webhosting. I can imagine few solutions:

  • Creating a wrapper library, which would export same functions as the original DLL + one new function
  • Injecting some functions into WebSite.dll (ildasm, add own code, ilasm or even directly?)
  • Complete disassembling back into the C# code (don't know if it is (still?) possible, 10yrs back it can be done with Reflector).
  • Rewriting whole site (pretty time consuming :) )

First two can reveal problem with routing as the website routing routines would not know about new "page". I don't have much experience with ASP.NET.

Which solution should I use or is there some other way to do it? Thanks!

I know this may come too late, but for what is worth, here's my 2 cents.

Disassembling will only be useful if the code was built with debugging information (and the DLL aren't obfuscated).

Other than that, i really depends on the code structure. That will limit what you can do and what you can't.

What i would do is something along these lines:

  1. Decompile DLLs and look at the methods
  2. Identify the methods you must overwrite, and make them overridable
  3. If the class is sealed, remove that attribute
  4. Create a class that inherits from the class you need to extend
  5. Override the necessary methods and create the new ones
  6. New methods should go into a new DLL
  7. Recompile disassembled DLLs

Depending on ASP.NET version you may have to change in the ASPX files the codebehind class to point to your new classes.

Hope this helps, it's a messy situation the one you're in :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM