[英]HTTP web request GET C#
I am trying to create HTTP Request to get the full html source with CSS styles. 我正在尝试创建HTTP请求以获取具有CSS样式的完整html源。 I already got the HTML source but without CSS styles !
我已经有了HTML源代码,但是没有CSS样式! , is there any other way to get full HTML with CSS styles ?
,还有其他方法可以获取带有CSS样式的完整HTML吗?
// create an instance
WebClient webClient = new WebClient();
// call the HTML page you want to download, and get it as a string
string htmlCode = webClient.DownloadString(uri);
return htmlCode;
Actually you can only get page text with "DownloadString" method. 实际上,您只能使用“ DownloadString”方法获取页面文本。 If css written in external file you can't get it.
如果CSS是用外部文件编写的,则无法获取。
Try this links: With Css - https://www.google.com/ Without Css - https://www.facebook.com/ 尝试以下链接:使用CSS- https : //www.google.com/不使用CSS- https : //www.facebook.com/
In google head tags include some css and you can get them. 在谷歌头标签包括一些CSS,你可以得到它们。 But facebook don't.
但是facebook没有。
您将必须包含尝试从中获取CSS内容的网站的完整CSS路径,例如:www.data.com/css/stylex.css
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.