I read on the asp.net mvc training site about introducing JavaScript, and the person became an eye opener.
I didnβt even realize / thought that someone was using JavaScript to make some strange orange injection attacks.
However, he left me with some unanswered questions.
First
When do you use html.encode? How do you use it only when you are going to display the information that this user or some other user has sent?
Or I use it for everything. As if I have a form that the user submits, this information will never be displayed to any of the users, should I still use html.encode?
How would I do this, as if I'm not sure how to embed the html.encode tag inside say and html.TextBox ().
Second
What will happen, I will say that I have a rich html editor on my site. The user has the right to use it and make things bold and any. Now I want to display information to the user through the label. I canβt Html.Encode it since then all bold and stuff will not be displayed.
But I canβt leave it the way it was, since this can prevent the user from adding some Javascript attack?
So what would I do? Use Regex to filter all tags?
Third
Is there another tag you can use called "AntiforgeryToken" when you use it?
thanks
Edit
Almost everyone says that they use the White List and Black List, how would I write this list and compare it with incoming values ββ(examples in C # would be good)?
source share