首页 > 解决方案 > 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;

标签: c#httprequest

解决方案


您必须包含您尝试从中获取 css 内容的网站的完整 css 路径,例如:www.data.com/css/stylex.css


推荐阅读