Recommended: Let’s talk about ASP output N rows and N lists In almost every site, we have to use programs to output lists: news lists, product lists, etc. The output method also varies depending on the content. For news lists, it is usually a circular output line by line; for product lists, Usually one cell is obtained
Emails published on web pages are often automatically extracted by some tools, and some illegal users will use the extracted email to send spam. Most of these tools are searching for the information behind the mailto: or the information before and after @ in the link to achieve the purpose of extracting email. I found a good way to prevent this information from being automatically extracted when looking at the source code of DotNetNuke (hereinafter referred to as DNN).
| The following is the quoted content: There is such a function in DNN (in Globals.vb): Public Function CloakText()Function CloakText(ByVal PersonalInfo As String) As String If Not PersonalInfo Is Nothing Then Dim sb As New StringBuilder ' convert to ASCII character codes, convert strings into ASCII encoded string sb.Remove(0, sb.Length) Dim StringLength As Integer = PersonalInfo.Length - 1 For i As Integer = 0 To StringLength sb.Append(Asc(PersonalInfo.Substring(i, 1)).ToString) If i < StringLength Then sb.Append(,) End If Next ' build script block Dim sbScript As New StringBuilder sbScript.Append(vbCrLf & <script language=javascript> & vbCrLf) sbScript.Append(<!-- & vbCrLf) 'fromCharCode method: Returns a string from some Unicode character values. sbScript.Append( document.write(String.fromCharCode( & sb.ToString & )) & vbCrLf) sbScript.Append(// --> & vbCrLf) sbScript.Append(</script> & vbCrLf) Return sbScript.ToString Else Return Null.NullString End If End Function This piece of code first converts the information that needs to be encrypted into ASCII encoded string form, and then writes it to the page using the document.write method in javascript. I tested the following effect, it was pretty good. You can also try it. <html> <head> <meta http-equiv=Content-Type content=text/html; charset=gb2312> <title>Test information encryption</title> </head> <body> Links that can be extracted: <a href=mailto:[email protected]>[email protected]</a><br> Links that cannot be extracted: <script language=javascript> <!-- document.write(String.fromCharCode(60,97,32,104,114,101,102,61,34,109,97,105,108,116,111,58,120,120,120,64,116,111,109, 46,99,111,109,34,62,120,120,120,64,116,111,109,46,99,111,109,60,47,97,62)) // --> </script> </body> </html> |
Share: Internal discussion on processing ASP requests ASP requests are initialized by WAM objects. The WAM object then sends it to ASP-RunTime. ASP-RunTime responds to it by creating an internal page object. A WAM object is a free thread object. When it calls an ISAPI extension such as ASP.DLL, it