Link to home
Start Free TrialLog in
Avatar of Progold S.p.A.
Progold S.p.A.Flag for Italy

asked on

Redirect from IhttpHandler ashx.vb file

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 (see 302.png)

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

Any idea?

thank you
302.png
tree.png
Avatar of Kamal Khaleefa
Kamal Khaleefa
Flag of Kuwait image

i think you need to use context.completeRequest instead
Avatar of Progold S.p.A.

ASKER

It's not working  :(

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

because completerequest was not available directly on context
('CompleteRequest' is not a member of 'System.Web.HttpContext')
Ps. I also tried with

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


but both didn't work
ASKER CERTIFIED SOLUTION
Avatar of Progold S.p.A.
Progold S.p.A.
Flag of Italy image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I solved the problem after the comment of the expert