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?

有帮助吗?

解决方案

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

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top