Hi, I'm new to ASP/ASP.NET and I have a small web site to create. The client wants me to build the site using ASP.NET but wants some existing ASP pages to be reused. This is fine except he also wants me to use this sort of technique
www.website.com/default.aspx?pageid=xxx with default.aspx providing common header/footer/ads etc and the main body of the page created with Server.Execute( filename ) where filename is looked up via it's pageid. This is probably a commonly used technique. So for example I have default.aspx which contains a table and Page_Load does this public class WebForm1 : System.Web.UI.Page { // one of the table cells set to runat="server" protected System.Web.UI.HtmlControls.HtmlTableCell mainbody; private void Page_Load(Object Src, EventArgs E ) { System.IO.StringWriter writer = new System.IO.StringWriter(); Server.Execute( "test.aspx", writer ); mainbody.InnerHtml = writer.ToString(); } The problem is that Server.Execute works fine if I pass it a .aspx page but not a .asp page. Is this expected? This is the exception I get: Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Web.HttpException: Error executing child request for test.asp. Line 23: { Line 24: System.IO.StringWriter writer = new System.IO.StringWriter(); Line 25: Server.Execute( "test.asp", writer ); <-- the offending line Note that the "test.asp" page does work ok if I access it directly via www.website.com/test.asp Any advice, workarounds appreciated. --------------------- Phil Lee You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.