Visual Studio .NET - How can I convert a HttpWebResponse to a string?

Asked By Gina Davis on 15-Feb-06 12:28 PM
I need to get my System.Net.HttpWebResponse and then check if it has a value or if the response is nothing. 

I have this line:
Response1 = CType(Request1.GetResponse(), System.Net.HttpWebResponse)
and I need to check if response1 is null or not. 

Thanks loads! for any ideas!

Try this - Asked By Ramya T on 15-Feb-06 01:50 PM

[CODE]

Dim Response1 As System.Net.HttpWebResponse
Dim sr As System.IO.StreamReader
Dim sResponse AS String 
sResponse = ""

Response1 = CType(objRequest.GetResponse(), System.Net.HttpWebResponse)
sr = New StreamReader(Response1.GetResponseStream())
sResponse = sr.ReadToEnd()

If sResponse.length > 0 then

'your code

else

'code goes here

end if	


[/CODE]