Hey, I am using a web service which is designed to give an HTTP 409 error in some cases. Along with this 409 error, the service sends an XML payload, which I need to be able to read. My problem is that my application is throwing an exception when I tried to fetch the site. Is there a way around this so that I can analyze the reponse xml despite the 409 error. Thanks in advance, here is the code:
Code:
Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
'STEP 1: Create a WebClient instance
Dim objWebClient As New WebClient()
'STEP 2: Call the DownloadedData method
Const strURL As String = "[URL unfurl="true"]http://somesite.com"[/URL]
Dim aRequestedHTML() As Byte
Dim strRequestedHTML As String
Try
aRequestedHTML = objWebClient.DownloadData(strURL)
Dim objUTF8 As New UTF8Encoding()
strRequestedHTML = objUTF8.GetString(aRequestedHTML)
Catch ex As System.Net.WebException
'not sure what to do hear to read response...
End Try
End Sub