Better Way to Download Zip file From Server Using VB.Net
up vote
-1
down vote
favorite
Developing Windows Application for Download zip file from server,
Using VB.Net(I am using Microsoft Visual Basic 2008 Express Edition)
I am doing following functionality
- Download zip file from server
- Extract Zip file to Folder, once Extraction finished then Delete Downloaded zip file.
- Showing Splash screen while Downloading
In this case I am Triggering Download function inside Background Worker for show splash screen , But Unable to Close Splash screen after Download
Please help How to Close Splashscreen
Triggering FTP Download Using Background Worker in form load event
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
BackgroundWorker1.RunWorkerAsync()
SplashScreen1.ShowDialog()
Catch ex As Exception
MsgBox(ex.Message.ToString(), MsgBoxStyle.Critical, "Error Message")
End Try
End Sub
Background Worker
Private Sub BackgroundWorker1_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
Try
'FTP Download Successful then Goto Unzip folder
If FTPDownload() = True Then
'Unzip Successful then Delete zip folder
If UnZip() = True Then
'Delete Zip file
If System.IO.File.Exists("D:LoginApp_Exev4.zip") = True Then
System.IO.File.Delete("D:LoginApp_Exev4.zip")
Else
MsgBox("Unable to Delete Zip file - File Not found", MsgBoxStyle.Critical, "Error Message")
End If
Else
MsgBox("Unable to Un Zip file", MsgBoxStyle.Critical, "Error Message")
End If
Else
MsgBox("File Download Failed", MsgBoxStyle.Critical, "Error Message")
End If
Catch ex As Exception
MsgBox(ex.Message.ToString(), MsgBoxStyle.Critical, "Error Message")
End Try
SplashScreen1.Dispose()
SplashScreen1.Close()
End Sub
Custom function for Download Zip file from Server
Private Function FTPDownload() As Boolean
Try
Using ftpClient As New WebClient()
ftpClient.Credentials = New System.Net.NetworkCredential("username", "password")
ftpClient.DownloadFile("ftp://Domain.com/v4/v4.zip", "D:LoginApp_Exev4.zip")
End Using
Catch ex As Exception
Return False
End Try
Return True
End Function
Having Some Doubts
Read Answer from this page https://stackoverflow.com/questions/4988286/what-difference-is-there-between-webclient-and-httpwebrequest-classes-in-net#answer-4988325
Here I am using WebClient for Download zip file, Which is Right method or not ?
Should Use FtpWebRequest ?
I did not Understand What is Difference Between WebClient & FTP Web Request
Please Can anyone Explain What is Response Stream and Stream Reader from above link.
And from above link WebClient Does not have timeout Property,
Please suggest correction for above code how to implement Code for handle Problem regarding Internet Connection Issues and timeout while Downloading
Custom Function for Unzip functionality
Note:- In this case I am using Ionic DLL for Extract zip file
Link of Ionic DLL https://www.dropbox.com/s/vcqjqlfieh7r6rq/Ionic.Zip.dll
Private Function UnZip() As Boolean
Try
ZipFolderName = "D:LoginApp_Exev4.zip"
Using zip As Ionic.Zip.ZipFile = Ionic.Zip.ZipFile.Read(ZipFolderName)
If Directory.Exists("D:\LoginApp_Exe\v4") Then
Directory.Delete("D:\LoginApp_Exe\v4", True)
End If
zip.ExtractAll("D:\LoginApp_Exe\v4")
End Using
Catch ex As Exception
Return False
End Try
Return True
End Function
Code Inside SplashScreen1.vb
Public NotInheritable Class SplashScreen1
Private Sub SplashScreen1_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
ProgressBar1.Style = ProgressBarStyle.Marquee
ProgressBar1.MarqueeAnimationSpeed = 60
ProgressBar1.Refresh()
End Sub
End Class
vb.net ftp
add a comment |
up vote
-1
down vote
favorite
Developing Windows Application for Download zip file from server,
Using VB.Net(I am using Microsoft Visual Basic 2008 Express Edition)
I am doing following functionality
- Download zip file from server
- Extract Zip file to Folder, once Extraction finished then Delete Downloaded zip file.
- Showing Splash screen while Downloading
In this case I am Triggering Download function inside Background Worker for show splash screen , But Unable to Close Splash screen after Download
Please help How to Close Splashscreen
Triggering FTP Download Using Background Worker in form load event
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
BackgroundWorker1.RunWorkerAsync()
SplashScreen1.ShowDialog()
Catch ex As Exception
MsgBox(ex.Message.ToString(), MsgBoxStyle.Critical, "Error Message")
End Try
End Sub
Background Worker
Private Sub BackgroundWorker1_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
Try
'FTP Download Successful then Goto Unzip folder
If FTPDownload() = True Then
'Unzip Successful then Delete zip folder
If UnZip() = True Then
'Delete Zip file
If System.IO.File.Exists("D:LoginApp_Exev4.zip") = True Then
System.IO.File.Delete("D:LoginApp_Exev4.zip")
Else
MsgBox("Unable to Delete Zip file - File Not found", MsgBoxStyle.Critical, "Error Message")
End If
Else
MsgBox("Unable to Un Zip file", MsgBoxStyle.Critical, "Error Message")
End If
Else
MsgBox("File Download Failed", MsgBoxStyle.Critical, "Error Message")
End If
Catch ex As Exception
MsgBox(ex.Message.ToString(), MsgBoxStyle.Critical, "Error Message")
End Try
SplashScreen1.Dispose()
SplashScreen1.Close()
End Sub
Custom function for Download Zip file from Server
Private Function FTPDownload() As Boolean
Try
Using ftpClient As New WebClient()
ftpClient.Credentials = New System.Net.NetworkCredential("username", "password")
ftpClient.DownloadFile("ftp://Domain.com/v4/v4.zip", "D:LoginApp_Exev4.zip")
End Using
Catch ex As Exception
Return False
End Try
Return True
End Function
Having Some Doubts
Read Answer from this page https://stackoverflow.com/questions/4988286/what-difference-is-there-between-webclient-and-httpwebrequest-classes-in-net#answer-4988325
Here I am using WebClient for Download zip file, Which is Right method or not ?
Should Use FtpWebRequest ?
I did not Understand What is Difference Between WebClient & FTP Web Request
Please Can anyone Explain What is Response Stream and Stream Reader from above link.
And from above link WebClient Does not have timeout Property,
Please suggest correction for above code how to implement Code for handle Problem regarding Internet Connection Issues and timeout while Downloading
Custom Function for Unzip functionality
Note:- In this case I am using Ionic DLL for Extract zip file
Link of Ionic DLL https://www.dropbox.com/s/vcqjqlfieh7r6rq/Ionic.Zip.dll
Private Function UnZip() As Boolean
Try
ZipFolderName = "D:LoginApp_Exev4.zip"
Using zip As Ionic.Zip.ZipFile = Ionic.Zip.ZipFile.Read(ZipFolderName)
If Directory.Exists("D:\LoginApp_Exe\v4") Then
Directory.Delete("D:\LoginApp_Exe\v4", True)
End If
zip.ExtractAll("D:\LoginApp_Exe\v4")
End Using
Catch ex As Exception
Return False
End Try
Return True
End Function
Code Inside SplashScreen1.vb
Public NotInheritable Class SplashScreen1
Private Sub SplashScreen1_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
ProgressBar1.Style = ProgressBarStyle.Marquee
ProgressBar1.MarqueeAnimationSpeed = 60
ProgressBar1.Refresh()
End Sub
End Class
vb.net ftp
add a comment |
up vote
-1
down vote
favorite
up vote
-1
down vote
favorite
Developing Windows Application for Download zip file from server,
Using VB.Net(I am using Microsoft Visual Basic 2008 Express Edition)
I am doing following functionality
- Download zip file from server
- Extract Zip file to Folder, once Extraction finished then Delete Downloaded zip file.
- Showing Splash screen while Downloading
In this case I am Triggering Download function inside Background Worker for show splash screen , But Unable to Close Splash screen after Download
Please help How to Close Splashscreen
Triggering FTP Download Using Background Worker in form load event
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
BackgroundWorker1.RunWorkerAsync()
SplashScreen1.ShowDialog()
Catch ex As Exception
MsgBox(ex.Message.ToString(), MsgBoxStyle.Critical, "Error Message")
End Try
End Sub
Background Worker
Private Sub BackgroundWorker1_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
Try
'FTP Download Successful then Goto Unzip folder
If FTPDownload() = True Then
'Unzip Successful then Delete zip folder
If UnZip() = True Then
'Delete Zip file
If System.IO.File.Exists("D:LoginApp_Exev4.zip") = True Then
System.IO.File.Delete("D:LoginApp_Exev4.zip")
Else
MsgBox("Unable to Delete Zip file - File Not found", MsgBoxStyle.Critical, "Error Message")
End If
Else
MsgBox("Unable to Un Zip file", MsgBoxStyle.Critical, "Error Message")
End If
Else
MsgBox("File Download Failed", MsgBoxStyle.Critical, "Error Message")
End If
Catch ex As Exception
MsgBox(ex.Message.ToString(), MsgBoxStyle.Critical, "Error Message")
End Try
SplashScreen1.Dispose()
SplashScreen1.Close()
End Sub
Custom function for Download Zip file from Server
Private Function FTPDownload() As Boolean
Try
Using ftpClient As New WebClient()
ftpClient.Credentials = New System.Net.NetworkCredential("username", "password")
ftpClient.DownloadFile("ftp://Domain.com/v4/v4.zip", "D:LoginApp_Exev4.zip")
End Using
Catch ex As Exception
Return False
End Try
Return True
End Function
Having Some Doubts
Read Answer from this page https://stackoverflow.com/questions/4988286/what-difference-is-there-between-webclient-and-httpwebrequest-classes-in-net#answer-4988325
Here I am using WebClient for Download zip file, Which is Right method or not ?
Should Use FtpWebRequest ?
I did not Understand What is Difference Between WebClient & FTP Web Request
Please Can anyone Explain What is Response Stream and Stream Reader from above link.
And from above link WebClient Does not have timeout Property,
Please suggest correction for above code how to implement Code for handle Problem regarding Internet Connection Issues and timeout while Downloading
Custom Function for Unzip functionality
Note:- In this case I am using Ionic DLL for Extract zip file
Link of Ionic DLL https://www.dropbox.com/s/vcqjqlfieh7r6rq/Ionic.Zip.dll
Private Function UnZip() As Boolean
Try
ZipFolderName = "D:LoginApp_Exev4.zip"
Using zip As Ionic.Zip.ZipFile = Ionic.Zip.ZipFile.Read(ZipFolderName)
If Directory.Exists("D:\LoginApp_Exe\v4") Then
Directory.Delete("D:\LoginApp_Exe\v4", True)
End If
zip.ExtractAll("D:\LoginApp_Exe\v4")
End Using
Catch ex As Exception
Return False
End Try
Return True
End Function
Code Inside SplashScreen1.vb
Public NotInheritable Class SplashScreen1
Private Sub SplashScreen1_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
ProgressBar1.Style = ProgressBarStyle.Marquee
ProgressBar1.MarqueeAnimationSpeed = 60
ProgressBar1.Refresh()
End Sub
End Class
vb.net ftp
Developing Windows Application for Download zip file from server,
Using VB.Net(I am using Microsoft Visual Basic 2008 Express Edition)
I am doing following functionality
- Download zip file from server
- Extract Zip file to Folder, once Extraction finished then Delete Downloaded zip file.
- Showing Splash screen while Downloading
In this case I am Triggering Download function inside Background Worker for show splash screen , But Unable to Close Splash screen after Download
Please help How to Close Splashscreen
Triggering FTP Download Using Background Worker in form load event
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
BackgroundWorker1.RunWorkerAsync()
SplashScreen1.ShowDialog()
Catch ex As Exception
MsgBox(ex.Message.ToString(), MsgBoxStyle.Critical, "Error Message")
End Try
End Sub
Background Worker
Private Sub BackgroundWorker1_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
Try
'FTP Download Successful then Goto Unzip folder
If FTPDownload() = True Then
'Unzip Successful then Delete zip folder
If UnZip() = True Then
'Delete Zip file
If System.IO.File.Exists("D:LoginApp_Exev4.zip") = True Then
System.IO.File.Delete("D:LoginApp_Exev4.zip")
Else
MsgBox("Unable to Delete Zip file - File Not found", MsgBoxStyle.Critical, "Error Message")
End If
Else
MsgBox("Unable to Un Zip file", MsgBoxStyle.Critical, "Error Message")
End If
Else
MsgBox("File Download Failed", MsgBoxStyle.Critical, "Error Message")
End If
Catch ex As Exception
MsgBox(ex.Message.ToString(), MsgBoxStyle.Critical, "Error Message")
End Try
SplashScreen1.Dispose()
SplashScreen1.Close()
End Sub
Custom function for Download Zip file from Server
Private Function FTPDownload() As Boolean
Try
Using ftpClient As New WebClient()
ftpClient.Credentials = New System.Net.NetworkCredential("username", "password")
ftpClient.DownloadFile("ftp://Domain.com/v4/v4.zip", "D:LoginApp_Exev4.zip")
End Using
Catch ex As Exception
Return False
End Try
Return True
End Function
Having Some Doubts
Read Answer from this page https://stackoverflow.com/questions/4988286/what-difference-is-there-between-webclient-and-httpwebrequest-classes-in-net#answer-4988325
Here I am using WebClient for Download zip file, Which is Right method or not ?
Should Use FtpWebRequest ?
I did not Understand What is Difference Between WebClient & FTP Web Request
Please Can anyone Explain What is Response Stream and Stream Reader from above link.
And from above link WebClient Does not have timeout Property,
Please suggest correction for above code how to implement Code for handle Problem regarding Internet Connection Issues and timeout while Downloading
Custom Function for Unzip functionality
Note:- In this case I am using Ionic DLL for Extract zip file
Link of Ionic DLL https://www.dropbox.com/s/vcqjqlfieh7r6rq/Ionic.Zip.dll
Private Function UnZip() As Boolean
Try
ZipFolderName = "D:LoginApp_Exev4.zip"
Using zip As Ionic.Zip.ZipFile = Ionic.Zip.ZipFile.Read(ZipFolderName)
If Directory.Exists("D:\LoginApp_Exe\v4") Then
Directory.Delete("D:\LoginApp_Exe\v4", True)
End If
zip.ExtractAll("D:\LoginApp_Exe\v4")
End Using
Catch ex As Exception
Return False
End Try
Return True
End Function
Code Inside SplashScreen1.vb
Public NotInheritable Class SplashScreen1
Private Sub SplashScreen1_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
ProgressBar1.Style = ProgressBarStyle.Marquee
ProgressBar1.MarqueeAnimationSpeed = 60
ProgressBar1.Refresh()
End Sub
End Class
vb.net ftp
vb.net ftp
asked 6 hours ago
Relax
94
94
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f207628%2fbetter-way-to-download-zip-file-from-server-using-vb-net%23new-answer', 'question_page');
}
);
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password