I have an IHttpHandler with the following ProcessRequest method:
public void ProcessRequest(HttpContext context) {
int id = Convert.ToInt32(context.Request.QueryString["id"] + 151);
var xml = XDocument.Parse("<xml><cartid>" + id + "</cartid></xml>");
context.Response.Write(xml);
}
Which I'm trying to use from an aspx page as follows:
protected void Page_Load(object sender, EventArgs e) {
order o = new order();
Server.Transfer(o, false);
}
I get an HttpException: Error executing child request for handler 'PostTest.order'.
If I instead try doing the transfer like:
Server.Transfer("~/order.ashx?id=65", false)
I get an HttpException: Error executing child request for /order.ashx.
Am I doing this wrong or is there another way to accomplish what I want?
Just pass the context:
var handler = new order();
handler.ProcessRequest(Context);
Response.End();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.