Reputation: 1
I have the following input tag to implement an auto complete search:
<input type="text" name="q" data-autocomplete-source="@Url.Action("QuickSearch", "User")" />
Will the user input be encoded automatically? And, if not, then how I can encode it?
Upvotes: 1
Views: 1975
Reputation: 61589
With Razor, by default all values are html encoded, unless you either explicitly use Html.Raw
, or are using a custom implementation of IHtmlString
.
Upvotes: 2
Reputation:
Utilize the HtmlHelper.Encode()
method to convert a value to an HTML-encoded string.
MSDN Reference for HtmlHelper.Encode()
Upvotes: 1