473,385 Members | 1,542 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

FileNotFoundException on Page.LoadControl

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

Apr 24 '07 #1
1 1742
Have you tried:

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

You could also experiment with the ResolveUrl method.
Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"py*********@gmail.com" wrote:
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

Apr 24 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Tom | last post by:
Hi, I have an index.aspx page which includes top.aspx, left.aspx, main.aspx and bottom.aspx. In the left.aspx, there is a login web control - login.ascx. It keeps session of username and role...
4
by: William LaMartin | last post by:
Is there a way to place an aspx page on a panel contained on another aspx page? I can display an HTML page on the panel using a literal can figure no way to put and aspx page there.
4
by: Christopher | last post by:
I am trying to load a UserControl which inherits from one of our customer classes which in turn inherits from UserControl. We use Page.LoadControl() from within our ASP.NET pages to load these...
4
by: Support | last post by:
Hello: I have a aspx web page - let's call it main.aspx It contains a placeholder: Myplaceholder. I have a web control, lets call it webcontrol which has a code behind class called...
5
by: alecyy | last post by:
hi, I create a UserControl called "RegInfo.ascx", then i add a PlaceHolder to WebForm1, and in WebForm1.Page_Load() i wrote the follow statement: placeHolder.Controls.Add(new RegInfo()); but...
5
by: MattC | last post by:
Hi, I am getting the following error: System.IO.FileNotFoundException: C:\Dreamtxt\WebSites\mysite\www\feedback.aspx at System.Web.UI.TemplateParser.GetParserCacheItem() at...
5
by: Jay Douglas | last post by:
I have a set of pages that inherit from a base class in the App_Code folder. The class looks something like: public class MyBaseClass : System.Web.UI.Page In various stages of the life cycle I...
1
by: Joe | last post by:
Hello All, I have a class that inherits from System.Web.UI.Page. In it I call the Page.LoadControl. I am having trouble with the virtual path that the LoadControl method accepts as its...
1
by: RSH | last post by:
Hi, I have a situation where I have a user Control (ResultHeader.ascx) that has a button. I am placing that control into a page (samplePage.aspx). I have setup a custom event, that should from...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.