c# - ASP.NET - Users have direct control on a Label control: this is safe? -
I have created a page where something entered in the text box is displayed "as is" on the label control
Since I am making a beginning, I have just created:
Label1.Text = TextBox1.Text.ToLower ();
Is it dangerous? I tried something but it appears that label control only takes the text, I believe it is safe
It's probably dangerous if the user will order some escape order?
Why not label1.Text = Server.HtmlEncode (TextBox1.Text.ToLower ()); You can do this . Do not do this so that you can be weakened based on how your app is configured.
Then it is dangerous in response - it depends, however, although ASP.net has validated user input to exclude HTML / scripts, it can be closed. Not to take better risk! You can learn about ASP.NET.
Comments
Post a Comment