예제 #1
0
 void FilterAttacks(string str, Func<string, bool> fn=null,[CallerMemberName] string propertyName = null)
 {
     var richtext = new RichText(str, PolicyFilePath);
     html.Append("\n== in == "+propertyName+" ==================================================\n原文:\n" + str + "\n");
     //html.Append("====================================================================================================");
     //html.Append("JavaScript:\n" + richtext.JavascriptEncode);
     html.Append("\n过滤:\n" + richtext.ToString());
     html.Append((fn == null ? null : "\n状态:" + (fn(str) ? "成功!" : "失败")));
 }
예제 #2
0
        void FilterAttacks(string str, Func<string, bool> fn,[CallerMemberName] string propertyName = null)
        {
            var richtext = new RichText(str, PolicyFilePath);
            txt += "\n==== in " + propertyName + " ==================================================\n原文:\n" + richtext.HtmlEncode + "\n";
            //这里是启用默认的安全策略
            str = "过滤\n" + HttpUtility.HtmlEncode(richtext.ToString());

            ////这里是使用指定的安全策略
            //str = "过滤\n" + HttpUtility.HtmlEncode(Filter.Filters(str));

            txt += str + "\n状态:" + (fn(str) ? "成功!" : "失败");
        }