A potentially dangerous Request.Form value was detected from the client (wresult=“<trust:RequestSecuri…”)

后端 未结 4 952
生来不讨喜
生来不讨喜 2021-01-17 11:18

I am also getting a request validation error when using WIF. I get correctly sent to the STS, but on the way back, I get this validation error.

I followed all the i

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-17 11:50

    In MVC 3 (not sure about 2) you can add a global filter in global.asax.cs e.g.

    public static void RegisterGlobalFilters(GlobalFilterCollection filters)
    {
        filters.Add(new ValidateInputAttribute(false));
    }
    

    That coupled with the following should allow all data in and display it correctly and safely I think:

    
    

    in web.config and using (note colon):

    <%: Model.Something %>
    

    or in Razor:

    @Model.Something
    

    and in some cases in Javascript:

    @Html.Raw(Ajax.JavaScriptStringEncode(Model.Something))
    

提交回复
热议问题