FileNotFoundException on Page.LoadControl

P

pyrusmagnus

Hi,

I'm having trouble loading a user control from inside my Sharepoint
webpart. A System.IO.FileNotFoundException occurs on this line:

Control myControl = Page.LoadControl("/UserControls/
SearchControl.ascx");

The UserControls folder is located under the root of my Sharepoint web
application and is configured as an Application in IIS, running under
the same ApplicationPool (with Network Service-credentials) as the
'parent' Sharepoint site.

When I create a sample test webpage (aspx) in the Sharepoint web
application root, the user control is loading just fine.

I'm stuck for several days now, so any help is greatly appreciated!

Thanks,
Diederik
 
G

Guest

Have you tried:

Control myControl = Page.LoadControl("~/UserControls/
SearchControl.ascx");

You could also experiment with the ResolveUrl method.
Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top