如何获得的HTML在C#中的一部分 [英] How to get a part of HTML in C#
本文介绍了如何获得的HTML在C#中的一部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请考虑以下情况:
我们有两个网页。包含一些控制,另一个页面一个简单的页面执行
第一页,并得到输出 HTML
。例如:
we have two web page. a simple page that contains some controls and another page that Execute
first page and get output HTML
. for example:
StringWriter textWriter = new StringWriter();
HttpContext.Current.Server.Execute("Blinker.aspx", textWriter);
Label1.Text= Server.HtmlEncode(textWriter.ToString());
和它返回此(例如):
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> </title>
</head>
<body>
<form method="post" action="Blinker.aspx" id="form1">
<div class="aspNetHidden">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTE2MTY2ODcyMjlkZKwUTjEtU7qJweOD/x+Op0ROdM+jDqyILuizFGhjOJQj" />
</div>
<div class="blink"> Some Test</div>
</form>
</body>
</html>
问题是,如果我只想:
the problem is if I want just:
<div class="blink"> Some Test</div>
我怎么可以输出HTML在C#中得到它?
how I can get it from output html in C#?
感谢
推荐答案
以下是选项
- 申请定期EX pression从响应HTML 这段文字
- 请XML文档,通过所有的潜水标记迭代。
这篇关于如何获得的HTML在C#中的一部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文