Import library to a precompiled ASP.NET website

1.3k Views Asked by At

I'm working on a C# updatable ASP.NET 2.0 precompiled website. Since the code-behind cannot be altered (source code is not available), I'm adding code directly inside the aspx files (inside the script tag).

The trouble is that a lot of identical code must be copy-pasted between multiple aspx files. I created an external library in order to avoid code duplication then referenced this library from the website. However, I'm not able to access the library's classes from the aspx files. I tried adding an import directive at the top of the page but it is not working at all.

What would be the recommend way to avoid code duplication?

1

There are 1 best solutions below

3
On BEST ANSWER

You could copy the assembly containing the common functionality to the bin folder and reference it to the <assemblies> section of the web.config. Now you can use it in aspx pages. But honestly that seems kind of perverted way to modify an ASP.NET site. Normally you would simply checkout the source code from version control, apply the necessary modifications, check-in, build, ship to staging, validate, ship to production. It's the way things should be done. Every other shipping into production process is simply ... (put whatever insult you would like here).