c# - HTTP Web 请求 GET C#
问题描述
我正在尝试创建 HTTP 请求以获取具有 CSS 样式的完整 html 源。我已经获得了 HTML 源代码,但没有 CSS 样式!, 有没有其他方法可以获得带有 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;
解决方案
您必须包含您尝试从中获取 css 内容的网站的完整 css 路径,例如:www.data.com/css/stylex.css
推荐阅读
- microsoft-graph-api - 如果地址包含特殊字符,如何更新工作表范围?
- javascript - 如何使用谷歌存储中的图像修复 Microsoft Azure 计算机视觉中的 InvalidImageFormat?
- javascript - 将一个文本框的值复制到另一个文本框返回 null
- c# - Azure VirtualNetworkGatewayConnection 没有 ExpressRoute ConnectionType 的 ConnectionStatus
- powershell - 命令行中的 PowerShell 参数、单引号和双引号
- c++ - 为什么我不能在 C++ 中将对象插入到地图中
- python - 如何利用 Django 用户模型的内置名字和姓氏功能?
- ruby-on-rails - 表单(文件)上传后显示警报
- java - 春季如何每30分钟更新一次缓存?
- java - 在 NetBeans 中设置类路径