response redirect from .ashx file

后端 未结 3 1212
醉梦人生
醉梦人生 2020-12-18 21:11

I have ashx file and I want to redirect from ashx to aspx page. Some solution?

相关标签:
3条回答
  • 2020-12-18 21:43

    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();

    0 讨论(0)
  • 2020-12-18 21:53

    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>");
    }
    
    0 讨论(0)
  • 2020-12-18 21:59
    void ProcessRequest(HttpContext context)
    {
         context.Response.Redirect(newUrl);
    }
    
    0 讨论(0)
提交回复
热议问题