Reusing UserControls via IIS virtual directory or something?

Posted on 2007-10-20
Last Modified: 2012-06-22

i have a user control (ascx) that has a javacript file and css file. I want to be able to use it in two separate web projects. This is for .NET2.0.
I tried making the usercontrol web project a virtual directory, however the other two web projects still could not use the controls.
Tried this.
<%@ Register Src="~/UserControlLibrary/MYUC.ascx" TagName="MyControl" TagPrefix="MyCompany" %>
UserControlLibrary is my virtual off the localhost.

how do i do this?

Question by:Valimai
    LVL 11

    Expert Comment

    If you're using Visual Web Dev 2005 Express, I don't think this can be done (please correct me if I'm wrong.......). If you're using the full version of Visual Studio, create new project and select ASP.NET server control. When you've build your control, you can compile it and add it to any web appllication that you create. You don't need VS to add the control.


    LVL 16

    Accepted Solution

    Try the instructions on the following MS page. If they don't work in VS Express tell us and I will look for an alternate solution.
    LVL 1

    Author Comment

    thank you very much, the article demonstrated exactly what i needed to do.

    using automated build scripts, I can publish (manually) and each web project that needs the control library can copy from the published location (currently automated) on build.

    I am now trying to work out how to publish on post build automatically. I have started a new question for this at

    thanks heaps

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Join & Write a Comment

    One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on could not pull conte…
    ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now