Alert is not showing after downloading ZIP file
Hi Guys,I used functionality to download PDF ZIP file for different users one by one.
I stored user those PDF file not generated successfully & want to show alert of those users list.
Users list is assigning in variable and file is also downloading for successfully generated pdf of users but alert is not showing for not generated PDF user.
My code are listed below, can you suggest me how to do that?
Private Function DownloadZip(ByVal strFolderpath As String, ByVal strMissingSub As String) As Boolean
Dim zip As New ZipFile()
Dim DocumentsArray() As String
Dim fInfo As FileInfo = Nothing
Try
If Not Directory.Exists(Server.MapPath(ConfigurationManager.AppSettings.Item("uploadfilepath").Trim()) + "\" + Me.HProjectId.Value.ToString() + "\" + strFolderpath) Then
Return True
End If
DocumentsArray = System.IO.Directory.GetFiles(Server.MapPath(ConfigurationManager.AppSettings.Item("uploadfilepath").Trim()) + "\" + Me.HProjectId.Value.ToString() + "\" + strFolderpath + "\FinalReportLinear")
If DocumentsArray.Length = 0 Then
Return True
End If
Dim response As System.Web.HttpResponse = System.Web.HttpContext.Current.Response
zip.AlternateEncodingUsage = ZipOption.AsNecessary
zip.AddDirectoryByName("Files")
For i = 0 To DocumentsArray.Length - 1
fInfo = New FileInfo(DocumentsArray(i))
If fInfo.Exists Then
Dim filePath As String = fInfo.FullName.ToString()
zip.AddFile(filePath, "Files")
End If
Next i
response.Clear()
Dim zipName As String = [String].Format("Zip_{0}.zip", DateTime.Now.ToString("yyyyMMMddHHmmss"))
response.ContentType = "application/zip"
response.AddHeader("content-disposition", "attachment; filename=" + zipName)
zip.Save(response.OutputStream)
response.Flush()
response.End()
Return True
Catch ex As Exception
Me.ShowErrorMessage("...........DownloadZip", ex.Message, ex)
Return False
Finally
If strMissingSub <> "" Then
ScriptManager.RegisterStartupScript(Me, Me.GetType(), "UniqueID", "alert('Dossier File Not Generated For Subject: " + strMissingSub + "')", True)
End If
End Try
End Function
Thanks in advance.