Hey,
I am trying to get the html source of a web site but getting an "Internal Server Error (500)" instead.
Why is it? What can I do?
This is the code:
Public Function GetHtmlDocument(ByVal URL As String) As IHTMLDocument2
Dim request As HttpWebRequest = WebRequest.Create(URL)
Dim response As HttpWebResponse = request.GetResponse()
Dim reader As StreamReader = New StreamReader(response.GetResponseStream(), System.Text.Encoding.GetEncoding("Windows-1255"))
Dim doc As New HTMLDocument
Dim objDoc As IHTMLDocument2 = doc
Dim param As Object() = {reader.ReadToEnd()}
objDoc.write(param)
response.Close()
reader.Close()
Return objDoc
End Function
thanks.