grab html

Results 1 to 2 of 2

Thread: grab html

  1. #1
    Join Date
    Dec 1969

    Default grab html

    hi, I posted before but no one responded, if any one has any help I would really appreciate it. Basically I am trying to grab html that is created in an admin section of my web site. the admin section is protected via forms authentication therefore when I do an httpwebrequest to grab the html I am bounced back to the login page. I have tried to log myself in in the webrequest, and redirect myself, but unfortunately the redirection doesn&#039;t seem to work. I have tried to pass a cookie with no success and I have tried to pass network credentials. Perhaps I am doing it all wrong, I would love some advice.<BR>thanks<BR>bethe

  2. #2
    Join Date
    Dec 1969

    Default RE: grab html

    Instead of redirecting to that page to retrieve the HTML, do it like this in the page that you are in:<BR><BR>WebRequest request = WebRequest.Create( "http://localhost/whateverpage.html" );<BR><BR>WebResponse response = request.GetResponse();<BR><BR>Stream s = response.GetResponseStream();<BR><BR>// Output the downloaded stream to the console<BR>StreamReader sr = new StreamReader( s );<BR>string line;<BR>while( (line = sr.ReadLine()) != null )<BR> // Do whatever with the text.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts