Web Control in separate project - Partially Solved

  • Thread starter Thread starter Jim Christiano
  • Start date Start date
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
 
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,
 
Back
Top