小编pit*_*kiy的帖子

如何修复“ HTTP标头中CRLF序列的不正确中和('HTTP响应拆分')”

运行VeraCode后,它在以下代码片段中报告了以下错误“ HTTP标头中的CRLF序列未正确中和('HTTP响应拆分')”:

protected override void InitializeCulture() {
        //If true then setup the ability to have a different culture loaded
        if (AppSettings.SelectLanguageVisibility) {
            //Create cookie variable and check to see if that cookie exists and set it if it does.
            HttpCookie languageCookie = new HttpCookie("LanguageCookie");
            if (Request.Cookies["LanguageCookie"] != null)
                languageCookie = Request.Cookies["LanguageCookie"];

            //Check to see if the user is changing the language using a query string.
            if (Server.UrlDecode(Request.QueryString["l"]) != null)
                languageCookie.Value = Server.UrlDecode(Request.QueryString["l"]);

            //Check to make sure the cookie isn't null …
Run Code Online (Sandbox Code Playgroud)

c# cookies veracode

5
推荐指数
2
解决办法
1万
查看次数

修复“xml 外部实体引用的不当限制”的最佳方法是什么?

我们最近运行了 VeraCode,它指出了以下方法:

    public XmlElement RunProcedureXmlElement(string Procedure, List<SqlParameter> Parameters)
    {
        DataSet ds = RunProcedureDataSet(Procedure, Parameters);
        XmlDocument xmlDoc = new XmlDocument();
        StringBuilder strXML = new StringBuilder();

        foreach (DataTable dt in ds.Tables)
        {
            foreach (DataRow dr in dt.Rows)
            {
                strXML.Append(dr[0]); // Do I still need .ToString()???
            }
        }
        if (strXML.Length == 0) strXML.Append("<root total=\"0\"></root>");

        try
        {
            xmlDoc.LoadXml(strXML.ToString());
        }
        catch (XmlException e)
        {

        }

        return xmlDoc.DocumentElement;
    }
Run Code Online (Sandbox Code Playgroud)

什么是修复该方法的好解决方案,以便 VeraCode 停止抱怨?

谢谢

.net c# xml veracode

2
推荐指数
1
解决办法
8913
查看次数

标签 统计

c# ×2

veracode ×2

.net ×1

cookies ×1

xml ×1