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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T23:46:32+00:00 2026-05-21T23:46:32+00:00

HI All, I need your suggestions/idea on this.When we started the project,client said that

  • 0

HI All,

I need your suggestions/idea on this.When we started the project,client said that we want
to accept Potentially Dangerous HTML Tags(like img,script,link etc...) into textbox,and we save textbox value into database.

Now,Client want to allow these tags ,but want to save these values in encoded form(to avoid xss)

Now, I just wanted to know that is there any way in asp.net ,so that I can replace behavior of all the existing textboxes with new SafeTextbox with minimal changes(I don’t want to add HtmlEncode or HtmlDecode to each textbox.)

For example

public class NewTextBox:TextBox
{
    public override string Text
    {
        get { return HttpUtility.HtmlDecode(base.Text); }
        set { base.Text = HttpUtility.HtmlEncode(value); }
    }

}

At runtime

ProjectTextBox replaces with NewTextBox
  • 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-21T23:46:32+00:00Added an answer on May 21, 2026 at 11:46 pm

    You could look into TagMapping in ASP.NET.

    http://msdn.microsoft.com/en-us/library/ms164641(v=vs.100).aspx

    The tagMapping element defines a collection of tag types that are remapped to other tag types at compile time. This remapping causes the mapped type to be used in place of the original tag type for all pages and controls in the ASP.NET application within the scope of the configuration file.

    <pages>
      <tagMapping>
         <add tagType="System.Web.UI.WebControls.TextBox"
              mappedTagType="Yournamespace.NewTextBox" 
         />
      </tagMapping>
    

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

Sidebar

Related Questions

I've got a reasonably simple query (this time) that I need ALL the results
I have multiple threads (C# application running on IIS) running that all need to
I've been trying to get this code to work for hours! All I need
I need to all of timestamps in a column the same amount. I want
This is beyond both making sense and my control. That being said here is
I want to use a temp directory that will be unique to this build.
I need your help! I want to create a desktop app and a mobile
All I need is a way to make a property of one class only
I need to retrieve all rows from a table where 2 columns combined are
I need to enumerate all the user defined types created in a SQL Server

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.