how to load html code into c# string?
HI, I've got a really seriously question.
I need to send HTML code, so I have to load html into string, an开发者_运维知识库d this obvious doesn't work if I can't interpret them well, how can I store it natively?
Thanks for your help
Strings and HTML should be fine. The only complication is escaping, which is made easier using verbatim string literals (@"..."). Then you just double any double-quotes:
string body = @"<html><body>
<a href=""foo.bar"" class=""blap"">blip</a>
...
</body></html>";
If you html code is in a file you can File.ReadAllText
string myString = System.IO.File.ReadAllText("path to the file");
精彩评论