我有一个代码 SaidFile.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:\blah\blah\blah\Blah.ascx: line 138
答案 0 :(得分:1)
您似乎使用了错误的网址GET参数:&
而不是?
。
根据MSDN路径应该是绝对的或相对于当前执行的ASPX,所以最好尝试这个:
Server.Execute(String.Format(Server.MapPath("/SaidFile.aspx")+"?id={0}", sID))