When using a web application, users often need to input text and leave it for later editing. At this time, we have to consider whether the text entered by the user contains keywords in HTML.
To remove HTML keywords, replace them with escape
I used to see a good function for converting text to HTML. Unfortunately, I lost it. Fortunately, I still remember the principle and decided to write it myself today.
Add validaterequest = "false" to the @ page of. aspx to use namespace: system.
The following is a reference fragment:The following are the referenced contents:#region///Filter HTML,JS,CSS codeFilter HTML,JS,CSS Code Parameters passed in public static string Checkstr (string html){System.Text.RegularExpressions.Regex regex1 =
CopyCode The Code is as follows: var lf = {};
Lf. Version = '1. 0.0 ';
// Global functions
Function $ (objname ){
Return document. getelementbyid (objname );
}
Function $ name (objname ){
Return document. getelementsbyname (objname );
}
Function $
Paip.51cto HTML transcoding rules
Blog for developing 51ctpProgramWhen httpclient is used, the standard HTML transcoding file cannot be sent...
After comparison with liver writer .. HTML transcoding is different .. The double quotation marks
/*************************************** ***************************************** Joneajax obtains DOM objects, Ajax operations, and reads and writes cookies.* @ Author Roddy * @ Site http://www.cnblogs.com/luomingui/* @ Version 1.0.0***************
1. Delete non-image tags
First, convert the IMG tag to a specific character, then filter out other HTML , and then convert the specific character back.
Html = html. Replace (// Html = html. Replace (/(♂[^>] *)>/G, "$1♀"); // Replace">"Alert
Window. open () method to open a new window, document. open () method to open a new document, where you can use the write () or writeln () method to write content. Its syntax is:
Onewdoc = Document. Open (smimetype [, sreplace]);
Sminetype is a
The web page thief program retrieves the source code of the Sina rolling news and directly saves it as an ASP file for execution. There are directly extracted programs on the Internet.Http://sindy.jyzxw.net/news sometimes cannot
XSSCross-site Scripting Solution
If you enter some content in the user form ,...... In particular, there are many form items with no fixed format, such as addresses,ArticleContent ...... In this case, you can enter JSCodeEtc.
Step 1: In the
Window. open () method to open a new window, document. open () method to open a new document, where you can use the write () or writeln () method to write content. Its syntax is:ONewDoc = document. open (sMimeType [, sReplace]);SMineType is a string
In the first article, I briefly describe what my CMS label means. Ancms (C # Edition) first bound data
Second, I'll show you the code that actually runs behind the tag. ASP.net's CMS principle article
As if open source is a bit redundant, the core
The window.open () method opens a new window in which the Document.open () method opens a new document in which the write () or Writeln () method can be used to write the content, and its syntax is:
Onewdoc = Document.open (smimetype[,
Public Function decodefilter (HTML, filter)
Html=lcase (HTML)
Filter=split (Filter, ",")
For all I in filter
Select case I
Case "Script" removes all client script javascipt,vbscript,jscript,js,vbs,event,...
html = Exere
PHP Malicious Code Filter function
Public Function decodefilter (HTML, filter)Html=lcase (HTML)Filter=split (Filter, ",")For each I in filterSelect case ICase "Script" removes all client script javascipt,vbscript,jscript,js,vbs,event,...html = Exere
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.
'
Filter HTML characters with text
Public
Function
Replacetotext (byval html
As
String
)
On
Error
Goto
Errlabel
'
Open error trap
'
------------------------------------------------
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.