17

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

skaffman
  • 398,947
  • 96
  • 818
  • 769
Ballon
  • 6,882
  • 18
  • 49
  • 63

3 Answers3

24
void ProcessRequest(HttpContext context)
{
     context.Response.Redirect(newUrl);
}
Vitaliy Liptchinsky
  • 5,221
  • 2
  • 18
  • 25
0

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

Community
  • 1
  • 1
Mark
  • 595
  • 5
  • 13
-2

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>");
}
halfzebra
  • 6,771
  • 4
  • 32
  • 47
musatotan
  • 1
  • 1