Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does HTML.Raw do?

Is HTML.raw() specific to MVC? On what scenarios we have to use it?

Can you please explain with an example.

like image 691
KeenUser Avatar asked Oct 13 '11 08:10

KeenUser


People also ask

Is it safe to use HTML Raw?

Raw can result in a XSS vulnerability being exploitable since an attacker can craft a special URL containing a malicious JavaScript payload that will be executed by the victim's browser if he or she sends an invalid 2FA confirmation code.

What does HTML raw do C#?

Using Html. Raw allows you to output text containing html elements to the client, and have them still be rendered as such. Should be used with caution, as it exposes you to cross site scripting vulnerabilities.

What can I use instead of HTML Raw?

asp.net mvc 3 - Razor Alternative to Html.

What is HTML DisplayFor?

DisplayFor() The DisplayFor() helper method is a strongly typed extension method. It generates a html string for the model object property specified using a lambda expression.


1 Answers

Text output will generally be HTML encoded. Using Html.Raw allows you to output text containing html elements to the client, and have them still be rendered as such. Should be used with caution, as it exposes you to cross site scripting vulnerabilities.

like image 71
Paddy Avatar answered Oct 12 '22 09:10

Paddy