holyraider
New member
- Joined
- Jan 18, 2012
- Messages
- 3
- Programming Experience
- Beginner
Hi there,
I work with Visual studio 2010 and net4.0 with Visual Basic as language.
im new to dotnet and at the moment im coding a application which does some calculations.
I try to implement a "update" feature which downloads the most recent .xml file where i get the numbers i need for the calculations from.
everything works absolutly fine, only my Update/download code seems to have some issue i cant fix.
I only include the small part of the code which is relevant to the webclient.
Here are my imports and the Module:
here is the event which executes the download:
---->>>>> At that point it throws an exception:
WebException was caught
"An exception occurred during a WebClient request."
Stacktrace :
"at System.Net.WebClient.DownloadFile(Uri address, String fileName)
at System.Net.WebClient.DownloadFile(String address, String fileName)
at Devisenrechner02.Form1.Button1_Click(Object sender, EventArgs e) in c:\Documents and Settings\*****\...
I cant find the problem and the exception info isnt very informative i think.
Hope you can help me and i also hope i posted in the right section..im just very new to programming and have no clue
Thanks in Advance
holyraider
I work with Visual studio 2010 and net4.0 with Visual Basic as language.
im new to dotnet and at the moment im coding a application which does some calculations.
I try to implement a "update" feature which downloads the most recent .xml file where i get the numbers i need for the calculations from.
everything works absolutly fine, only my Update/download code seems to have some issue i cant fix.
I only include the small part of the code which is relevant to the webclient.
Here are my imports and the Module:
VB.NET:
Module Module1
Sub Main()
Dim FileAdress As String = String.Empty
Dim FileName As String = String.Empty
Try
Dim FileReader As New WebClient()
FileAdress = "[URL]http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml[/URL]"
FileName = FileAdress.Substring(FileAdress.LastIndexOf("/") + 1)
FileReader.DownloadFile(FileAdress, "C:\" + FileName)
Catch ex As HttpListenerException
Console.WriteLine("Error Accessing " + FileAdress + "-" + ex.Message)
Catch Ex As Exception
Console.WriteLine("Error Accessing " + FileAdress + "-" + Ex.Message)
End Try
End Sub
End Module
here is the event which executes the download:
VB.NET:
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles bnUpdate.Click
Dim FileAdress As String = String.Empty
Dim FileName As String = String.Empty
Try
Dim FileReader As New WebClient()
FileAdress = "[URL]http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml[/URL]"
FileName = FileAdress.Substring(FileAdress.LastIndexOf("/") + 1)
FileReader.DownloadFile(FileAdress, "C:\")
Catch ex As HttpListenerException
MessageBox.Show("Download Error")
Console.WriteLine("Error Accessing " + FileAdress + "-" + ex.Message)
---->>>> Catch Ex2 As Exception
MessageBox.Show(Ex2.StackTrace)
Console.WriteLine("Error Accessing " + FileAdress + "-" + Ex2.Message)
End Try
End Sub
WebException was caught
"An exception occurred during a WebClient request."
Stacktrace :
"at System.Net.WebClient.DownloadFile(Uri address, String fileName)
at System.Net.WebClient.DownloadFile(String address, String fileName)
at Devisenrechner02.Form1.Button1_Click(Object sender, EventArgs e) in c:\Documents and Settings\*****\...
I cant find the problem and the exception info isnt very informative i think.
Hope you can help me and i also hope i posted in the right section..im just very new to programming and have no clue
Thanks in Advance
holyraider