我有ashx文件,我想从ashx重定向到aspx页面。一些解决方案
我有ashx文件,我想从ashx重定向到aspx页面。一些解决方案
void ProcessRequest(HttpContext context)
{
context.Response.Redirect(newUrl);
}
void ProcessRequest(HttpContext context)
{
context.Response.Redirect(newUrl);
}
使用context.Response.Redirect(newUrl);导致页面显示:
“物体搬到了 这里“。
更新: 发生这种情况是因为我退出了,在这种情况下答案是使用FormsAuthentication.RedirectToLoginPage();
你的coudl通过编写处理程序来完成它。
我找到了一个解决方案,它应该工作正常:
context.Response.ContentType = "text/plain";
if (controlcase)
{
//Write code, what you want...
context.Response.Write("This is result");
}
else
{
context.Response.Write("<script>location.href='url you want to redirect'</script>");
}