Function HTMLEncode(Str)
If Isnull(Str) Then
HTMLEncode = ""
Exit Function
End If
Str = Replace(Str,Chr(0),"", 1, -1, 1)
Str = Replace(Str, """", """, 1, -1, 1)
Str = Replace(Str,"<","<", 1, -1, 1)
Str = Replace(Str,">",">", 1, -1, 1)
Str = Replace(Str, "script", "script", 1, -1, 0)
Str = Replace(Str, "SCRIPT", "SCRIPT", 1, -1, 0)
Str = Replace(Str, "Script", "Script", 1, -1, 0)
Str = Replace(Str, "script", "Script", 1, -1, 1)
Str = Replace(Str, "object", "object", 1, -1, 0)
Str = Replace(Str, "OBJECT", "OBJECT", 1, -1, 0)
Str = Replace(Str, "Object", "Object", 1, -1, 0)
Str = Replace(Str, "object", "Object", 1, -1, 1)
Str = Replace(Str, "applet", "applet", 1, -1, 0)
Str = Replace(Str, "APPLET", "APPLET", 1, -1, 0)
Str = Replace(Str, "Applet", "Applet", 1, -1, 0)
Str = Replace(Str, "applet", "Applet", 1, -1, 1)
Str = Replace(Str, "[", "[")
Str = Replace(Str, "]", "]")
Str = Replace(Str, """", "", 1, -1, 1)
Str = Replace(Str, "=", "=", 1, -1, 1)
Str = Replace(Str, "'", "''", 1, -1, 1)
Str = Replace(Str, "select", "select", 1, -1, 1)
Str = Replace(Str, "execute", "&#101xecute", 1, -1, 1)
Str = Replace(Str, "exec", "&#101xec", 1, -1, 1)
Str = Replace(Str, "join", "join", 1, -1, 1)
Str = Replace(Str, "union", "union", 1, -1, 1)
Str = Replace(Str, "where", "where", 1, -1, 1)
Str = Replace(Str, "insert", "insert", 1, -1, 1)
Str = Replace(Str, "delete", "delete", 1, -1, 1)
Str = Replace(Str, "update", "update", 1, -1, 1)
Str = Replace(Str, "like", "like", 1, -1, 1)
Str = Replace(Str, "drop", "drop", 1, -1, 1)
Str = Replace(Str, "create", "create", 1, -1, 1)
Str = Replace(Str, "rename", "rename", 1, -1, 1)
Str = Replace(Str, "count", "count", 1, -1, 1)
Str = Replace(Str, "chr", "chr", 1, -1, 1)
Str = Replace(Str, "mid", "mid", 1, -1, 1)
Str = Replace(Str, "truncate", "truncate", 1, -1, 1)
Str = Replace(Str, "nchar", "nchar", 1, -1, 1)
Str = Replace(Str, "char", "char", 1, -1, 1)
Str = Replace(Str, "alter", "alter", 1, -1, 1)
Str = Replace(Str, "cast", "cast", 1, -1, 1)
Str = Replace(Str, "exists", "exists", 1, -1, 1)
Str = Replace(Str,Chr(13),"<br>", 1, -1, 1)
HTMLEncode = Replace(Str,"'","''", 1, -1, 1)
End Function

  

通用安全字符串输入,彻底替换server.htmlencode的更多相关文章

  1. Server.HTMLEncode用法

    Server.HTMLEncode用法!! Server.HTMLEncode HTMLEncode 一.HTMLEncode 方法对指定的字符串应用 HTML 编码. 语法 Server.HTMLE ...

  2. HttpUtility.HtmlDecode ,HttpUtility.HtmlEncode 与 Server.HtmlDecode ,Server.HtmlEncode 与 HttpServerUtility.HtmlDecode , HttpServerUtility.HtmlEncode

    HtmlEncode: 将 Html 源文件中不允许出现的字符进行编码,通常是编码以下字符"<".">"."&" 等. ...

  3. 剑指offer 1,输入一个字符串,将字符串的空格替换成%20

    剑指offer 1,输入一个字符串,将字符串的空格替换成%20    function replaceSpace(str){      return str.replace(/\s/g,"% ...

  4. 【C#】C#中的HtmlEncode与HtmlDecode:HttpUtility.HtmlEncode,HttpUtility.HtmlDecode,Server.HtmlEncode,Server.HtmlDecode,WebUtility.HtmlEncode,WebUtility.HtmlDecode

    HtmlEncode(String) 将字符串转换为 HTML 编码字符串. HtmlDecode(String) 将已经为 HTTP 传输进行过 HTML 编码的字符串转换为已解码的字符串. 在we ...

  5. 在Vi里面实现字符串的批量替换

    在Vi里面实现字符串的批量替换. a. 文件内全部替换: %s#abc#def#g(用def替换文件中所有的abc) 例如把一个文本文件里面的"linuxidc.com"全部替换成 ...

  6. python字符串截取与替换的例子

    python字符串截取与替换的多种方法 时间:2016-03-12 20:08:14来源:网络 导读:python字符串截取与替换的多种方法,以冒号分隔的字符串的截取方法,python字符串替换方法, ...

  7. fscanf(格式化字符串输入)

    fscanf(格式化字符串输入) 相关函数 scanf,sscanf 表头文件 #include<stdio.h> 定义函数 int fscanf(FILE * stream ,const ...

  8. asp.net Server.HtmlEncode和HtmlDecode

    <html xmlns="http://www.w3.org/1999/xhtml"><head runat="server">< ...

  9. C字符串输入输出函数

    下面就几个常用的字符串输入输出函数做个小小的总结TAT 使用时添加头文件:#include<stdio.h>. scanf("格式控制字符串",变量地址列表):(pri ...

随机推荐

  1. dataStructure@ Binary Search Tree

    #include<iostream> #include<cstdio> #include<cstring> #include<limits> #incl ...

  2. 第十三章、学习 Shell Scripts 循环 (loop)

    while do done, until do done (不定循环) while [ condition ] <==中括号内的状态就是判断式 do <==do 是回圈的开始! 程序段落 ...

  3. hdu 2715 Herd Sums

    Herd Sums Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total S ...

  4. TcxVerticalGrid demo

    procedure TForm1.Button1Click(Sender: TObject);var row: TcxEditorRow; i,t: Integer;begin grid.ClearR ...

  5. Remastersys打包你自己的ubuntu成iso文件,保存原来的所有配置

    你是不是辛辛苦苦地配好了ubuntu结果不久又重装,然后又重新配置很久呢? 笔者好不容易配置好了torch,但是换硬盘,于是就想到了将ubuntu打包成iso文件,下次直接安装,然后配置好的东西都搬过 ...

  6. NGUI学习笔记(一):官方视频学习记录

    学习NGUI一直断断续续的,目前打算做一个总结的笔记. 我使用的是比较老的3.6.0版本. 1.使用NGUI,需要开启“Edit”->“Project Settings”->“Physic ...

  7. PHP中各种Hash算法性能比较

    国内私募机构九鼎控股打造APP,来就送 20元现金领取地址:http://jdb.jiudingcapital.com/phone.html内部邀请码:C8E245J (不写邀请码,没有现金送)国内私 ...

  8. 显示 png 图片

    uses   pngimage;{显示 png 图片}procedure TForm1.Button2Click(Sender: TObject);var  png: TPngImage;begin  ...

  9. cocos2d_x_08_游戏_FlappyBird

    终于效果图: 环境版本号:cocos2d-x-3.3beta0 使用内置的物理引擎 计时器没有加入,可參考[cocos2d_x_06_游戏_一个都不能死] 主场景 // // FlappyBirdSc ...

  10. [Web] What Is JSONP?

    JSONP—or JSON with padding—is a sneaky technique that web developers came up with to work around the ...