【发布时间】:2012-07-12 05:08:50
【问题描述】:
我正在开发一个asp.net 网站。我需要使用c# 替换html 中的特定字符串。以下是html。 在这里,我需要使用 c# 代码将“@name”替换为有效名称。 我尝试使用 java 脚本。它正在工作。我如何使用 c# 来实现这一点?
如何使用 c# 或 HtmlAgilityPack 获取当前页面的 HTML 以对其进行解析?
HTML:
<div>
In the @name, you may have configured an iPad in both the AppleDevices and the TabletDevices configuration. However, because AppleDevices may have been set for a small display size, you want an iPad to use the TableDevices configuration (which has a larger screen). Reorder the devices in the following order so that an iPad will use the TableDevices configuration first.
Tablet Devices
Apple Devices
</div>
【问题讨论】:
-
"我如何获取当前页面的 HTML" 如果您使用的是 WebForms、MVC、NancyFX,您还没有告诉我们...
标签: c# html string replace html-agility-pack