response redirect from .ashx file

旧时模样 提交于 2019-11-29 09:21:56
void ProcessRequest(HttpContext context)
{
     context.Response.Redirect(newUrl);
}
Mark H

Using context.Response.Redirect(newUrl); results in a page that says:

"Object moved to here."

Update: This happened because I signed out, in that case the answer is to use FormsAuthentication.RedirectToLoginPage();

musatotan

I found a solution and it should work fine:

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>");
}
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!