-3

I'm trying to download a aspx page's html from an another page, using the following code:

  WebClient webClient = new WebClient();
             String CompleteReport = webClient.DownloadString(new System.Uri(reportURL));

however the HTML that is returned contains the markup similar to the following:

"\r\n\r\n<!DOCTYPE html>\r\n\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\r\n<head><meta charset=\"utf-8\" 

what should i do to download a string without these escape sequences.

Thank You!

Zee
  • 622
  • 4
  • 13
  • What markup - the embeded CRLF ("\r\n") ? What would you expect to see in place of a carriage return/line feed pair ? – PhillipH Jan 06 '17 at 19:47
  • none, i just want the html without the escape sequences, This HTML would an another html page, – Zee Jan 06 '17 at 19:48
  • @PhillipH yeah, silly me, forgot about encodings.... thanks for you help – Zee Mar 19 '17 at 23:21

1 Answers1

3

The string doesn't actually contain those sequences. It contains the characters that they represent (actual newline and linefeed characters).

You are probably viewing the string in a debugger and the debugger is adding those sequences for you. If you dump it to a file and read it in notepad they won't be there.

See also this answer. If you add ,nq to the variable name in the watch window, the escape sequences will go away.

Community
  • 1
  • 1
John Wu
  • 50,556
  • 8
  • 44
  • 80
  • yeah, just figured that out, thanks!! Silly me, :) Thank you guys for the help!. :) – Zee Jan 06 '17 at 19:51