我有一个代码说 saidifile。aspx在页面加载时执行。当执行该代码时,将生成一个pdf文件并将其存储在服务器上。我试图在另一个文件的上下文中执行该页,但使用以下代码:
Server.Execute(String.Format("~/SaidFile.aspx&id={0}", sID))
我得到了以下错误:
System.Web.HttpException: Error executing child request for ~/~/SaidFile.aspx&id=32.
---> System.Web.HttpException: No http handler was found for request type 'POST' at System.Web.HttpApplication.MapIntegratedHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig, Boolean convertNativeStaticFileModule)
at System.Web.HttpServerUtility.Execute(String path, TextWriter writer, Boolean preserveForm)
--- End of inner exception stack trace
--- at System.Web.HttpServerUtility.Execute(String path, TextWriter writer, Boolean preserveForm)
at System.Web.HttpServerUtility.Execute(String path)
at ASP.modules_onlinepayments_controls_paymentprocessgeneric_ascx.processPayment()
in D:blahblahblahBlah.ascx: line 138
似乎您使用了错误的URL为您的GET参数:&
而不是?
。
根据MSDN路径应该是绝对的或相对于当前执行的ASPX,所以最好试试这个:
Server.Execute(String.Format(Server.MapPath("/SaidFile.aspx")+"?id={0}", sID))