[Webinar] Learn how to a build a cloud-first strategyRegister Now


Reusing UserControls via IIS virtual directory or something?

Posted on 2007-10-20
Medium Priority
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

ID: 20114217
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

McExp earned 2000 total points
ID: 20114248
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.


Author Comment

ID: 20116475
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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 www.johnchapman.name could not pull conte…
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

864 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