Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

319
Views
XSS: How can I remove JS snippets from a String in C#?

My usecase is actually quite simple. Let's say I get an input argument like abcdalert(document.cookie); and I want to scrub it off the (document.cookie); part. What is the most efficient way to do this in ASP.NET C#?

PS: The snippet can be any JS code. Not necessarily alerts.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I recommend the HtmlSanitizer .Net library to apply server side sanitization

https://github.com/mganss/HtmlSanitizer

This library used for cleaning HTML fragments and documents from potential XSS attacks. It uses AngleSharp to parse, manipulate, and render HTML and CSS. It is based on a robust HTML parser that can protect your code from deliberate or accidental "tag poisoning" where invalid HTML in one fragment can corrupt the whole document (which can lead to a broken layout or style)

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!