Jump to content

System.Net.WebClient error handling

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
3 replies to this topic

#1
deas

deas

    Newbie

  • Members
  • Pip
  • 7 posts
Hello all,

Im using this line to get my program to check online for the latest version of my software.

Dim strLatestVer As String = New System.Net.WebClient().DownloadString("xxx://my.server/latest.version")

The file 'latest.version' is just a textfile with the text "1.x.x.x".

No the problem is, if the url is unavaible or there is no internet connection on the computer running the program, it dies.

So im trying to figure out a way to just make the program skip this if it cant reach the url.

Any ideas?

#2
Termana

Termana

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 4,057 posts
this might be a hackish sort of way but if its throwing an exception you could just use exception handling
Posted via CodeCall Mobile

#3
deas

deas

    Newbie

  • Members
  • Pip
  • 7 posts
You wouldnt mind giving me some examples? :)

#4
deas

deas

    Newbie

  • Members
  • Pip
  • 7 posts
Nm, solved it myself using the "TRY" method :)