ehsan shirzadi
ehsan shirzadi

Reputation: 4859

How to reuse web user controls from another project in the solution?

I want to use web user controls inside 'Controls' project inside the 'Web' project in the same solution. but when I reference 'Web' to 'Controls' and then drag the control into a web form in 'web' project the Register directive's src is like this:

<%@ Register src="http://localhost:59388/UC/Menu/MenuManager.ascx" tagname="MenuManager" tagprefix="uc1" %> 

and an error says:

http:/localhost:59388/UC/Menu/MenuManager.ascx' is not a valid virtual path.

Some people say thay It's not possible to reuse web user controls and we have to convert them to Server controls, but I've seen somewhere some one did this. Do you know how to do this?

Upvotes: 0

Views: 4385

Answers (1)

Srikanth Venugopalan
Srikanth Venugopalan

Reputation: 9049

You cannot use an ascx via http. Essentially you are trying to get the ASP.NET compiled and processed output of the user control if you do that.

You are better off writing a Control Library if you plan to share controls. See this question

Scott Guthrie has a write-up about creating User Control Libraries

Upvotes: 2

Related Questions