AJM
AJM

Reputation: 32490

ASP.NET Label Control - Don't encode HTML

I know this is an XSS risk but for my sepcific scenario am willing to accept it.

I want to use an ASP.NET label control in suh a way that I give it some HTML and it renders it as html without being encoded.

Is this possible?

Upvotes: 7

Views: 9546

Answers (2)

Ravinder Singh
Ravinder Singh

Reputation: 846

May be you can try Server.HtmlDecode() and Server.HtmlEncode() functions to change the way HTML is displayed on your page.

Upvotes: 3

jerjer
jerjer

Reputation: 8770

Use Literal Control instead of Label

Upvotes: 10

Related Questions