Hi all i have vb code below which i am tring to call when someone click on the link.
Private Sub DownloadFile(ByVal fname As String, ByVal forcedownload As Boolean)
Dim flpth As String
Dim fnm As String
Dim ext As String
Dim tp As String
flpth = System.IO.Path.GetFullPath(Server.MapPath(fname))
fnm = System.IO.Path.GetFileName(flpth)
ext = System.IO.Path.GetExtension(fnm)
tp = ""
If Not IsDBNull(ext) Then
ext = LCase(ext)
End If
Select Case ext
Case ".doc", ".rtf"
tp = "application/msword"
Case ".pdf"
tp = "application/pdf"
Case ".zip"
tp = "application/zip"
End Select
If (forcedownload) Then
Response.Clear()
Response.ClearContent()
Response.ClearHeaders()
Response.ContentType = tp
Response.AppendHeader("Content-Disposition", "attachment; filename=" + fnm + ext)
Response.TransmitFile(flpth)
Response.Flush()
Response.End()
End If
End Sub
I am tring to call above code in below line but its not working. Please can any body help.
<a id="Click" runat="server" href="#" onclick="DownloadFile('files/Notes.doc',True)">Click here</a>