Blog Stats
  • Posts - 26
  • Articles - 0
  • Comments - 78
  • Trackbacks - 0

 

ASP.Net ile HtmlEncode

Hangi namepspace ile kullanacağımıza karar vermek için google search yaptığımız komutlardan birisi de HtmlEncode. Her seferinde google search yapmamak için bloga yazdım. Hem Live Writer ile blog yazısı yazmak çok kolaylaştı.

Kullanıcıdan aldığımız herhangi bir yazıyı asla direkt tarayıcıda görüntülememeliyiz.

SQL Enjeksiyonu ya da benzeri saldırılara maruz kalmamak için yapamız gerkenlerden birisi de HtmlEncode ile html olması muhtemel text içeriği escape karakterleri ile dönüştürmektir.

using System.Web;

private static string ReturnEncoded()
{
	return (HttpUtility.HtmlEncode("<br />"));
}

<br /> komutu &lt;br /&gt; haline geliyor. Tarayıcı da alt satıra geçmek yerine ekrana <br/> yazıyor.


Feedback

# re: ASP.Net ile HtmlEncode

Gravatar I was working on a command line C# executable and couldn’t find out for the life of me how to get some sort of an HttpServerUtility object. I didn’t realize that HttpUtility existed. 1/12/2010 4:00 PM | Rapid Share

# re: ASP.Net ile HtmlEncode

Gravatar Took me time to read all the comments, but I really enjoyed the article. It proved to be Very helpful to me and I am sure to all the commenters here! It's always nice when you can not only be informed, but also entertained.Its really a great. 2/5/2010 12:13 PM | bonus casino en ligne

Post a comment





 

Please add 6 and 3 and type the answer here:

 

 

Copyright © Yunus Özen