Question

I used to have an embedded user control in an ASP.NET web site which was working fine. But later I converted the web site to a Web Application after that when I refer to the user control it give an error.

System.Web.HttpException was unhandled by user code Message=The file '/Controls/CustomControls.dll/TestCustomControl.ascx' does not exist.

I verified dll is in the correct place and build action of TestCustomControl.ascx is set to "Embedded Resource".

Était-ce utile?

La solution

This user control is embedded to the dll by setting it's property Build Action to Embedded Resource.

The problem was with my virtual path provider. I had to register the virtual path provider in "Application_Start" method in Global.asax. In my working web site it was done in AssemblyResourceProvider in App_Code. When converting Web site to Web App since theres no App_Code in web app this whole code was missing.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top