WebClient Throwing Remote Server Error 500

Hi

I am using webclient to read some web site content ...which display the page error like.

Server Application Unavilable.

IIS 6.0 is the webserver....when I triyed the URL in the Browser... its showing like

Server Application UnAvailable.. But My application its throwing Remote Server Error like

The remote server returned an error: (500) Internal Server Error.

The purpose of this code is monitor urls which shows the server application unavilable I would like capture the error content.

likeServer Application Unavilable.

But my code going to Exception.... . I tried google and other sites to read i am able to see the content...Only Server Application Unavilable Error I am not able to see... throwing Remote Error.. the URL Is Existing...

Code which i used

Try

Dim URL As String = "http://localhostTestApp11" '"http://localhost:1357" '"http://www.google.com"

Dim myWebClient As New WebClient()

Dim myStream As Stream = myWebClient.OpenRead(URL)

Dim sr As New StreamReader(myStream)

Dim str As String

str = sr.ReadToEnd()

MessageBox.Show(str.ToString())

myStream.Close()

Catch ex As Exception

MessageBox.Show(ex.Message & ex.StackTrace)

End Try

Does any one can help me ...

Regards

Deepu M.I

[3115 byte] By [Deepu.MI] at [2007-12-23]
# 1
Deepu.MI wrote:

Hi

I am using webclient to read some web site content ...which display the page error like.

Server Application Unavilable.

IIS 6.0 is the webserver....when I triyed the URL in the Browser... its showing like

Server Application UnAvailable.. But My application its throwing Remote Server Error like

The remote server returned an error: (500) Internal Server Error.

The purpose of this code is monitor urls which shows the server application unavilable I would like capture the error content.

like Server Application Unavilable.

But my code going to Exception.... . I tried google and other sites to read i am able to see the content...Only Server Application Unavilable Error I am not able to see... throwing Remote Error.. the URL Is Existing...

Code which i used

Try

Dim URL As String = "http://localhostTestApp11" '"http://localhost:1357" '"http://www.google.com"

Dim myWebClient As New WebClient()

Dim myStream As Stream = myWebClient.OpenRead(URL)

Dim sr As New StreamReader(myStream)

Dim str As String

str = sr.ReadToEnd()

MessageBox.Show(str.ToString())

myStream.Close()

Catch ex As Exception

MessageBox.Show(ex.Message & ex.StackTrace)

End Try

Does any one can help me ...

Regards

Deepu M.I

Deepu.MI at 2007-8-30 > top of Msdn Tech,.NET Development,.NET Framework Networking and Communication...

.NET Development

Site Classified