1

I have a web application that contains a bunch of classes in the App_Code folder. I compile the project and publish it to the IIS server.

I want to share some of the code in the app_code folder with another application on the server and therefore I think I need to register an assembly in the GAC.

What is the best way to do this? I have read this article: http://msdn.microsoft.com/en-us/library/Aa479044, which suggests a number of options?

3 Answers 3

2

Put the code in a class library, and add the library as a project reference to both applications.

Side Note:

If you need to access the request or response, etc. import the Sysyem.Web library and use the HttpContext object. This will give you most, if not all the information available to the page.

Sign up to request clarification or add additional context in comments.

Comments

1

You'll have to move the code into a separate project, which will output a library.

If you have any references to dlls related to the ASP .Net or web in general, you can reference them from that library.

The code might not compile in the first, but you can refactor it, it really depends on how tight is with what is in App_Code.

You can then reference that library on the Web Site (you'll have to refactor here too some things). The library, once is signed, can be added to GAC also.

10 Comments

what do you mean by refactor?
Will might have to rewrite some code. For example when moving from App_Code to a library, this library will have a new namespace. That namespace needs to be imported to your files.
I see. As a temporary solution; is there a way to register the DLLs generated when building an ASP.NET web app?
You don't have to register to dll on your machine, unless your are using on several projects (solutions). You'll have to register it on the deployment machine.
as I said in the original question - I am looking to share the DLL in multiple projects (two).
|
0

The solution for me was to expose the shared functionality in a web service.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.