Public Sub GetFilePath(sender As Object, e As EventArgs) Try Dim iBtn As ImageButton = DirectCast(sender, ImageButton) ScriptManager.GetCurrent(Page).RegisterPostBackControl(iBtn) Dim item As RepeaterItem = CType(iBtn.NamingContainer, RepeaterItem) Dim fpath As Label = CType(item.FindControl("lblFilePath"), Label) If (fpath.Text <> "") Then f_FileName = fpath.Text f_FolderName = "~/ICT_ImpFiles/ClaimDocus/" Response.Redirect("~/DownloadImage.ashx?ImageName=" & "S_" & f_FileName & "&FolderName=" & f_FolderName) Else lblAlert.Text = "Sorry! There is no file found!" ScriptManager.RegisterStartupScript(Me, Me.[GetType](), "Pop", "showModal1();", True) End If Catch ex As Exception lblmessage.Text = "Er: " & ex.Message lblAlert.Text = ex.Message ScriptManager.RegisterStartupScript(Me, Me.[GetType](), "Pop", "showModal1();", True) End Try End Sub DownloadImage.ashx Imports System.Web Imports System.Web.Services Imports System Public Class ShowImage Implements System.Web.IHttpHandler Dim file As String = "" Dim folders As String = "" Dim filename As String = "" Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest If (Not (context.Request.QueryString("ImageName")) Is Nothing) Then file = context.Request.QueryString("ImageName").ToString End If If (Not (context.Request.QueryString("ImageName")) Is Nothing) Then folders = context.Request.QueryString("FolderName").ToString End If filename = context.Server.MapPath(folders + file) Dim fileInfo As System.IO.FileInfo = New System.IO.FileInfo(filename) Try context.Response.Clear() context.Response.AddHeader("Content-Disposition", "attachment;filename=" + fileInfo.Name) context.Response.AddHeader("Content-Length", fileInfo.Length.ToString) context.Response.ContentType = "application/octet-stream" context.Response.TransmitFile(fileInfo.FullName) context.Response.Flush() Catch ex As Exception context.Response.ContentType = "text/plain" context.Response.Write(ex.Message) Finally context.Response.End() End Try End Sub ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable Get Return False End Get End Property End Class