Hi - When user clicks save button, i want the browser to show save as dialog box and user can select where to save the image file.

In the code behind i am using following code on save click event. but it does not work and throws error at run time. Does some one know how to do it right?

    Protected Sub btnSave_Click(sender As Object, e As System.EventArgs) Handles btnSave.Click
        HttpContext.Current.Response.ContentType = "image/jpeg"
        HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment; filename=" + Session.SessionID + "out.jpg")
        HttpContext.Current.Response.TransmitFile(Server.MapPath("~/Temp/" + Session.SessionID + "out.jpg"))
    End Sub