是否可以Page.PreviousPage
在通用 .ashx 处理程序中检索 .aspx 页面的跨页面 PostBack 的等价物?
我需要从执行 PostBack 的页面访问一些 POST 值,并且 - 虽然我可以简单地使用Request.Form
- 有问题的值来自 WebControls,因此,它们的名称相当模糊(而且不是很健壮)(例如 ctl00$WebFormsContent$SomeControl $SomeOtherControl$txtWhatever)。
我尝试了以下方法:
public void ProcessRequest(HttpContext context)
{
Page previous = context.PreviousHandler as Page;
if (previous != null)
context.Response.Redirect("http://www.google.com");
}
但是,这不起作用 - 在调试时,我可以看到它context.PreviousPage
是空的。
有没有办法检索此信息并将其转换为Page
?