Kendo网格的Antixss

时间:2019-04-02 13:28:14

标签: asp.net-mvc kendo-grid xss kendo-asp.net-mvc antixsslibrary

Controller.cs

ViewData["Applications"] = await _applicationClient.GetAll();

view.cshtml

@(Html.Kendo().Grid<ResourceViewModel>
()
.Columns(columns =>
{columns.ForeignKey(r => r.ApplicationId, (System.Collections.IEnumerable)ViewData["Applications"], "Id", "Assembly").Title("Application").Width(100);})

ForeignKey列的antixss代码是什么?

1 个答案:

答案 0 :(得分:1)

保存到数据库时,使用HttpUtility.HtmlEncode(..)解决了类似的问题。

 HttpUtility.HtmlEncode(application);