Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3806654
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T14:52:06+00:00 2026-05-19T14:52:06+00:00

We have taken over a .NET project recently and upon looking at the db

  • 0

We have taken over a .NET project recently and upon looking at the db we have the following in some columns:

1) Some columns have values such as
" & etc etc

2) Some have <script> tags and other non html encoded tags

This data is displayed all over the site. When trying out HtmlEncoding on point number 1 we get the following &quot; -> &amp;quot;

Obviously we are wanting to htmlencode when displaying as point 2 contains javascript which we don’t want executed.

Is there a way to use HtmlEncoded on values that might or might not be already encoded?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T14:52:07+00:00Added an answer on May 19, 2026 at 2:52 pm

    Is there a way to use HtmlEncoded on values that might or might not be already encoded?

    No there isn’t.

    What i would suggest is that you write a quick script that goes through the database and unencode the already encoded data. Then use something like the Microsoft AntiXSS library (tutorial here) to encode all output before it gets output to the web page. Remember that it is fine to store the data unencoded1, the danger is when you echo it back out to the end user.

    Some controls already encode output using encode functionality built into the .Net framework – which is not bulletproof to XSS – you just have to either avoid using those controls or just not encode the data displayed by them. There is a FAQ question pertaining to the MS controls that encode at the bottom of the page for the first link which you should read. Also some third party control vendors encode the output of their controls, you would do yourself a favor if you test them to make sure they are not still susceptible to XSS.

    1Don’t forget to take steps to prevent SQL injection though!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have taken over some .NET 1.1 Windows Service code that spawns threads to
I have a good sized hobby project, around 66K LOC, over at http://www.wheelmud.net Recently,
I installed Resharper in VS2008 and it seems to have taken over some of
i have taken over an asp project from a friend and he was basically
I have taken over a large code base and would like to get an
I have to take over and improve/finish some code that transforms Java objects from
Say suppose 10 developers have taken 6 months to develop some application. As a
Recently, many programmers and that includes me, have taken the X out of AJAX,
Ok guys just a small game: I have some specifications for a project. At
I have deliberated endlessly over which language/framework best suits the following. I need to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.