allowing user to type html tags inside html textarea

I have a html textarea on my page in my ASP.NET Web Forms application.
https://www.w3schools.com/tags/tag_textarea.asp

If a user types some html code like this inside my textarea

p>test</p><span>test</span>

When i run my page it causes an error.

I read this article:
https://www.codeproject.com/tips/297679/a-potentially-dangerous-request-form-value-was-det

So then,
if I add these 2 lines of code inside the <system.web> tags, that fixes the issue and I no longer get an error , the textarea accepts the html tags ok.

<system.web>

        <httpRuntime requestValidationMode="2.0" />
        <pages validateRequest="false" />

</system.web>

Is there a better way to allow a user to type html tags inside my textarea without having to add those 2 lines inside my Web.Config of my application ?
LVL 1
maqskywalkerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

zephyr_hex (Megan)DeveloperCommented:
You may want to consider the security implications of allowing HTML tags in a form element (input, textarea, etc)
0
Shaun VermaakTechnical Specialist/DeveloperCommented:
And if you do, you should HTML encode the text from that textarea before saving/using it
0
lenamtlCommented:
Hi,

You can use a plugin like TinyMce
https://www.tinymce.com/

With this editor you can have HTML template.
I'm using it with Raw option and it's also have a html code option (in Format list).
You can create a list of span so the user can select one.
This is useful to allow user to select Bootstrap component for example.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.