Web Control in separate project - Partially Solved

J

Jim Christiano

Everyone,

In order to promote code reuse, I've setup a web control (.ascx) in a
standalone vs.net project. I can then reference this project in any web
application. The trick is to setup a virtual directory that points to the
location of the web control in each parent application.

The issue is that IIS doesn't seem to like this. The error I receive is:

It is an error to use a section registered as
allowDefinition='MachineToApplication' beyond application level. This error
can be caused by a virtual directory not being configured as an application
in IIS.

The only way I've found around this is to modify the machine.config file and
remove attributes from sections.

Has anyone ever solved this issue? I have checked and re-checked that all
folders are correctly registered as IIS applications.

Thanks,
Jim Christiano
 
T

Tim Stephenson

This doesn't really answer your question, but a much nicer way to do this
would be to create a server control and place it in a GAC'd assembly.
Alternatively you could create a similar result by using a skinned web
control, and again placing the actual server control in a GAC'd assembly.
This would eliminate the problems as the DLL would be in the GAC and hence
accessible to the applications.

Web controls are generally intended for code-reuse within an application. If
you want to use it cross application, then server controls are usually a
better option.

Hope this helps,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top