views:

50

answers:

2

Our internal HR application is developed by the vendor, but I've been given a requirement to change the behaviour of a certain piece of functionality without their assistance (which I don't want to do, but am investigating...). The functionality in question is an .ashx page which does a number of database lookups, and is called via javascript functions on a web page. We want to add one further database lookup.

We have control over the javascript code, so that's not a problem, but the code for the .ashx page is held in a compiled assembly. I've found where it is, and looked into it using .Net Reflector. Reimplementing the methods involved wouldn't be difficult, if it were technically feasible.

Can I create a new assembly, paste the source taken using Reflector into it, make my modifications, add the DLL to the application, and then set up a new .ashx to refer to it?

The bits I'm worried about not being possible are:

The code refers to some vendor classes held in other assemblies; can I just add references to those assemblies in Visual Studio to allow it to compile, and then when it's compiled and put on the server it'll all work?

Will I have trouble getting the web application to accept the new DLL, given that generally this application is not something we make changes to ourselves?

EDIT: Some clarification: I'm not actually planning to replace the vendor's DLL with one of my own, that does sound like going a bit too far. Instead, I would make a new DLL with just the one function in it I need (based on stuff taken from the existing DLL using Reflector). I'd need that code to reference other utility vendor code so that it can get at classes needed to access the framework. I'd make a brand new .ashx page to serve up the code in the new DLL.

Luckily after all this I'm off the hook, because my customer agrees that things aren't desperate enough for us to attempt all this! But thanks for the assistance, which is definitely useful.

A: 

See my comment about the risk of the approach you're considering.

I really don't recommend the overall approach, but yes, it is possible to reference assemblies you don't have the source for; just add references to the project which will use them.

Replacing the code-behind for the .ashx may be possible depending on whether it's precompiled. If it's not, then I believe replacing the DLL in the BIN folder should do the trick. (Assuming no other assemblies are referencing it.) (DISCLAIMER: I've never tried this, and I don't recommend it.)

ThatBlairGuy
OK, point taken, thanks. Will definitely take the least nightmareish path if it comes to that!
frumious
A: 

If you are just looking to get some additional data, I'd just implement my own lookup and call it from Javascript, rather than messing with reflector. Is there any reason that you can't do that?

James O'Sullivan
I'll basically do that, but as it happens the way the data has to be retrieved from the framework means I need something to start me off, and I can get that from the vendor DLL.
frumious