开发者

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");
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜