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

All I need this for is strcpy(). I want to see whether the first
I need your suggestions in solving this issue. Here is the requirement. We have
All, I need your help to merge the result in the same datetime in
Possible Duplicate: Regular expression: match all words except I need your help for using
first of all, I'm really thankful for all your help. I need just one
I have a whole bunch of buttons that all need to have both a
I just have the array of 15 values that all need to be inserted
I need your suggestions on how I should go about implementing an ever-increasing numbering
i really confused what to do and need your suggestions for my DB Design.
I need your suggestions for my problem area. I am working with SharePoint 2010.

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.