1

I have a problem with a ashx.vb file

Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest

        Try
               /*  CODE TO UPLOAD THE FILE */

                context.Response.Redirect("~/Prodotti/STEP6.aspx", False)
                Return
            Catch ex As Exception
                Throw New Exception("Error", ex)
            End Try

        Catch ex As Exception
            Dim msg As String = GestioneErrori.TrapError(ex)
            context.Response.Write(msg)
        End Try

    End Sub

I use it to process the request of uploading a file using uploadify. I need to reload the page which contains the fileUpload object. I think context.Response.Redirect("~/Prodotti/STEP6.aspx", False) was the only way but it doen't work. The file upload shows http error 302

the ashx.vb file is store in a folder at the same level of the folder which contains the page to be redirected

I tried also with

context.Response.Redirect("~/Prodotti/STEP6.aspx", False)
context.ApplicationInstance.CompleteRequest()

and

HttpContext.Current.Response.Redirect("~/Prodotti/STEP6.aspx", False)
HttpContext.Current.ApplicationInstance.CompleteRequest()

and

HttpContext.Current.ApplicationInstance.Response.Redirect("~/Prodotti/STEP6.aspx", False)
HttpContext.Current.ApplicationInstance.CompleteRequest()

and

Dim url As String
url = context.Request.Url.ToString().ToLower()
url = Replace(url, "step6", "step5")
context.Response.Buffer = True
context.Response.Status = "302 Object moved"
context.Response.AddHeader("Location", url)
context.Response.Write("<HTML><Head>")
context.Response.Write("<META HTTP-EQUIV=Refresh CONTENT=""0;URL=" & url & """>")
context.Response.Write("<Script>window.location='" & url & "';</Script>")
context.Response.Write("</Head>")
context.Response.Write("</HTML>")

but all of them didn't work

Any idea?

thank you

Ps. I've found a similar question about it but unfortunately that doesn't solve my problem (response redirect from .ashx file)

thank you

Community
  • 1
  • 1

0 Answers0