In some cases, users are prohibited from submitting HTML-containing content due to security considerations. However, client verification and restrictions are always untrusted.
At this time, we need to securely process the submitted content and
All websites can obtain the HTML source code compiled by the website through the URL. The method is as follows:
Namespace to be used:
Using system;
Using system. Collections. Generic;
Using system. text;
Using system. diagnostics;
Using system. Text.
After fetching data from a Web page (such as a description), if it is displayed as it is, it may be disrupted by its inclusion of an HTML tag that is not closed, or it may use a more "obscure" HTML tag to disrupt the booking format. If you delete
ASP tutorial. NET regular replaces the HTML tag with the deletion of the specified character method, using regular expressions for rule filtering, since HTML tags are based on the <> format and there are symbols like . So it's 2 times. Processing
// Add validateRequest = false to the top of the page.
Public static string NoHTML (string Htmlstring) // Replace the HTML Tag{// Delete the scriptHtmlstring = Regex. Replace (Htmlstring, @ " "," ", RegexOptions. IgnoreCase );// Delete
If you delete all of the HTML tags inside, you may have difficulty reading (such as A, IMG tags), preferably by deleting a part and retaining part of it.
In regular expressions, it is very easy to understand that it is quite understandable to
Several Methods for getting simple HTML Tag content
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->// ==================================== Begin1 ====================== ==========
// Test
If you delete all of the HTML tags inside, you may have difficulty reading (such as A, IMG tags), preferably by deleting a part and retaining part of it.
In regular expressions, it is very easy to understand that it is quite understandable to
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.