Microsoft KB Archive/823266

= &quot;FileNotFoundException&quot; Error Message When You Use Page.LoadControl to Load a Web User Control =

Article ID: 823266

Article Last Modified on 5/8/2007

-

APPLIES TO


 * Microsoft Windows SharePoint Services

-





SYMPTOMS
When you try to use the Page.LoadControl method to load a Web user control (.ascx file) in a Web Part of a Microsoft Windows SharePoint Services Web page, you may receive the following error message:

FileNotFoundException

The file could not be found.

C:\Inetpub\Wwwroot\Program Files\Common Files\Microsoft Shared\Web Server Extensions\60\Template\1033\STS\filename.ascx



CAUSE
This problem may occur if you use a relative path in the Page.LoadControl method to load a Web user control, as in the following example:

Dim myControl As MyControl = CType(Page.LoadControl(&quot;MyControl.ascx&quot;), MyControl)



WORKAROUND
To work around this behavior, specify an absolute path when you use the Page.LoadControl method, as in the following example: Dim myControl As MyControl = CType(Page.LoadControl(&quot;/MyControl.ascx&quot;), MyControl)



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.



MORE INFORMATION
For more information, visit the following Microsoft Web site:

http://msdn2.microsoft.com/en-us/library/w70c655a(vs.71).aspx

Keywords: kbprb KB823266

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.