问题 响应从.ashx文件重定向


我有ashx文件,我想从ashx重定向到aspx页面。一些解决方案


9706
2018-01-12 12:49


起源



答案:


void ProcessRequest(HttpContext context)
{
     context.Response.Redirect(newUrl);
}

16
2018-01-12 12:53



不再工作了:( - Craig


答案:


void ProcessRequest(HttpContext context)
{
     context.Response.Redirect(newUrl);
}

16
2018-01-12 12:53



不再工作了:( - Craig


使用context.Response.Redirect(newUrl);导致页面显示:

“物体搬到了 这里“。

更新: 发生这种情况是因为我退出了,在这种情况下答案是使用FormsAuthentication.RedirectToLoginPage();


0
2018-03-15 21:48





你的coudl通过编写处理程序来完成它。

http://dotnetperls.com/ashx-handler


-1
2018-01-12 12:55





我找到了一个解决方案,它应该工作正常:

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>");
}

-1
2017-11-05 11:07