Tag: html

.Net从html页面中删除javascript和css代码块

我有html作为javascript和css代码块的字符串。 像这样的东西: alert(‘hello world’); A:link {text-decoration: none} A:visited {text-decoration: none} A:active {text-decoration: none} A:hover {text-decoration: underline; color: red;} 但我不需要它们。 如何使用reqular表达式删除那些块?

如何使用method =“post”从表单中获取数据? 如何在我的控制器中请求数据?

我试图从我的HTML代码中获取数据,如“acquringCode”,“cardAcceptor”和“merchantId”。 我无法想象如何在我的控制器中获取该数据。 我知道它的request.form。 我相信我做错了。 有没有更简单的方法让我通过函数传递对象或每个名称作为参数? HTML $(document).ready(function () { $(“#SavetreventLocationLookupAddButton”).click(function () { $(“#addSaveTreventLocationLookup”).submit(); }); }); 添加Trevent位置查找 <form id="addSaveTreventLocationLookup" method="post" action="”> Trevent Location Lookup Detail Acquiring Institution Identification Code: Card Acceptor Identification Code: Merchant Id: Add Cancel 位指示 [HttpPost] [AuthorizeAttribute(AdminRoles = “AddTreventLocationLookup”)] public ActionResult AddSaveTreventLocationLookup() { try { string acquiringInstitutionIdentificationCode; //= Request.Form[“AcquiringInstitutionIdentificationCode”] ?? string.Empty; string cardAcceptorIdentificationCode;// […]

将字符实体转换为其unicode等效项

我在数据库中有html编码的字符串,但许多字符实体不仅仅是标准的& 和< 。 实体喜欢“ 和— 。 不幸的是,我们需要将这些数据提供给基于闪存的rss阅读器,而flash不会读取这些实体,但它们会读取等效的unicode(ex “ )。 使用.Net 4.0,是否有任何实用方法可以将html编码的字符串转换为使用unicode编码的字符实体? 这是我需要的更好的例子。 db有html字符串,如: John & Sarah went to see $ldquo;Scream 4$rdquo;. John & Sarah went to see $ldquo;Scream 4$rdquo;. 我需要在rss / xml文档中输出标签: <p>John & Sarah went to see “Scream 4”.</p> <p>John & Sarah went to see “Scream 4”.</p> 我正在使用XmlTextWriter从数据库记录创建xml文档,类似于此示例代码http://www.dotnettutorials.com/tutorials/advanced/rss-feed-asp-net-csharp.aspx 所以我需要将数据库中的html字符串中的所有字符实体替换为其unicode等效,因为基于闪存的rss阅读器无法识别超出最常见的任何实体,例如& 。

如何使用C#从HTML页面中删除标签?

if (window.self === window.top) { $.getScript(“Wing.js”); } 在C#中是否有办法修改上述HTML文件并将其转换为以下格式: 基本上我的目标是从HTML页面中删除所有JavaScript。 我不知道修改HTML文件的最佳方法是什么。 我想以编程方式进行,因为有数百个文件需要修改。

如何在.NET HTML邮件中嵌入图像?

我有一个HTML Mail模板,带有图像的占位符。 我正在获取我需要从数据库发送的图像并将其保存到照片目录中。 我需要将图像嵌入HTML消息中。 我已经探索过使用AlternateView: AlternateView htmlView = AlternateView.CreateAlternateViewFromString(” “); LinkedResource VisitorImage = new LinkedResource(p_ImagePath); VisitorImage.ContentId= “VisitorImage”; htmlView.LinkedResources.Add(VisitorImage);

HTML Agility Pack解析大小写标签?

我使用HTML Agility Pack效果很好,我对此印象非常深刻 – 但是,我选择的内容是这样的 doc.DocumentNode.SelectSingleNode(“//body”).InnerHtml 如何处理以下情况,使用不同的文件? 我的代码上面只会得到小写版本吗?

如何使用C#来清理html页面上的输入?

是否有用于清理html页面输入的库或可接受的方法? 在这种情况下,我有一个只有姓名,电话号码和电子邮件地址的表单。 代码必须是C#。 例如: “John Doe”应成为”John Doe”