Using New Code Nuggets in ASP.NET4

We will talk about new feature in ASP.NET 4.

Suppose you have the following code-behind property and you need to use it in ASPX page.

 

 

In ASPX page you can render the property MyContent like below:

 

 

And this will render the below output:

This is an XSS (cross-site script injection) and the developer should be aware of this, so he should do an HTMLEncode

 

Because of many developer may forget to do this, ASP.NET introduced the below code nugget

Now, the result will be;

Summery