Link to home
Start Free TrialLog in
Avatar of MetaDataY
MetaDataY

asked on

Grabbing content from an external web server

The application in question is ASP.NET / C#. I have a webform with some text boxes, and it submits via the POST method to a web server out of my control. That web server displays a report in html to the user in the browser window.

What I would like to do is:

- Keep the user on my site instead of leaving to the other site.
- Save the contents of the report to a database.
- Show the report in a new browser window from the content stored in the database in the previous step.

Can somebody point me in the right direction on how to do this?
Avatar of fritz_the_blank
fritz_the_blank
Flag of United States of America image

Try using this function to grab the content:

Function GetHTML(strURL)
      Dim objXMLHTTP, strReturn
      Set objXMLHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP")
      objXMLHTTP.Open "GET", strURL, False
      objXMLHTTP.Send
      strReturn = objXMLHTTP.responseText
      Set objXMLHTTP = Nothing
      GetHTML = strReturn
End Function
ASKER CERTIFIED SOLUTION
Avatar of ajitanand
ajitanand

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of MetaDataY
MetaDataY

ASKER

Ajit Anand, that's what I'm looking for. I had actually found how to do this with HttpWebRequest and HttpWebResponse, where you have to specify content length and stream to the request and streamread the response. WebClient seems to be even easier.

Thank you both for your input!