简体   繁体   English

ASP.NET扩展应用程序没有源代码

[英]ASP.NET extending application without source code

I need to extend some web application, probably in ASP.NET WebPages. 我需要扩展一些Web应用程序,可能在ASP.NET WebPages中。 Just add one function, a non-framework PHP equivalent would be uploading some newfunc.php file 只需添加一个函数,一个非框架的PHP等价物将上传一些newfunc.php文件

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. 它有唯一的问题 - 我没有源代码(试图获得它3个月),只能在webhosting上访问.dll。 I can imagine few solutions: 我可以想象一些解决方案:

  • Creating a wrapper library, which would export same functions as the original DLL + one new function 创建一个包装器库,它将导出与原始DLL +一个新函数相同的功能
  • Injecting some functions into WebSite.dll (ildasm, add own code, ilasm or even directly?) 将一些函数注入WebSite.dll(ildasm,添加自己的代码,ilasm甚至直接?)
  • Complete disassembling back into the C# code (don't know if it is (still?) possible, 10yrs back it can be done with Reflector). 完全反汇编回C#代码(不知道是否(仍然?)可能,10年后可以用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. 我对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. 我知道这可能来得太晚,但值得一提的是,这是我的2美分。

Disassembling will only be useful if the code was built with debugging information (and the DLL aren't obfuscated). 只有在使用调试信息构建代码(并且DLL不进行模糊处理)时,反汇编才有用。

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 反编译DLL并查看方法
  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 新方法应该进入一个新的DLL
  7. Recompile disassembled DLLs 重新编译反汇编的DLL

Depending on ASP.NET version you may have to change in the ASPX files the codebehind class to point to your new classes. 根据ASP.NET版本,您可能必须在ASPX文件中更改代码隐藏类以指向新类。

Hope this helps, it's a messy situation the one you're in :) 希望这会有所帮助,这是一个混乱的情况你在那里:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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