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 8478207
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T18:40:57+00:00 2026-06-10T18:40:57+00:00

What is the best practice? I am making a ASP.NET site where the user

  • 0

What is the best practice? I am making a ASP.NET site where the user can input text data to be stored at a SQL database. I am using HttpUtility.HTNLEncode() to store the data and HTMLDecode to display it.

This works well, but it does searching (selecting or free text) a lot more difficult. The user should be able to enter text containing <, “, ‘ and any other problematic character.

What is the best practice? To store the data un-encoded? How can I mitigate the risks of injection then?

  • 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-06-10T18:40:59+00:00Added an answer on June 10, 2026 at 6:40 pm

    Always store user input in the database unencoded, and always encode user input from database before outputting it.

    You also should filter/validate user input before persisting.

    • Input: User input -> Validate/filter -> Persist to database
    • Output: Content from database -> Encode -> Output to client

    This is the only sane way to use and reuse user data.

    See also http://msdn.microsoft.com/en-us/library/t4ahd590%28v=vs.80%29.aspx#cpconbestsecuritypracticesforwebapplicationsanchor4
    as well as Should HTML be encoded before being persisted?

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

Sidebar

Related Questions

Is there a best practice for making an entity immutable? Users create exercises in
Is there a best practice for making private methods in classes static? I have
What's the best practice of making a variable that would be accessible by almost
What would be the best practice to keep the user logged in if he
What is the best practice for generating valid XML with PHP from user submitted
I am learning how to create a website using ASP.NET & C#. Right now
Is there a best practice for making tooltip type functionality accessible to people with
I can't confirm that this syntax is best practice. I would like to reference
Just wondering what the best practice for handling login/user authentication in mvc3 would be.
I am making an app (asp.net/c#) that will autosuggest a couple fields that users

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.