Click here to Skip to main content
12,701,087 members (28,201 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: ASP.NET validation
i have a problem . if i want to save html tags icluded text such as <html> i get below problem :

" A potentially dangerous Request.Form value was detected from the client... "
i dont want to disable page ValidationRequest . what i do ?
Posted 7-Mar-12 22:34pm
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

  Permalink  
Comments
Tech Code Freak 8-Mar-12 3:53am
   
5up!
walterhevedeich 8-Mar-12 3:59am
   
Thanks.
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

You should use JavaScript (or a server-side script) to properly escape any user input. Here's another JavaScript function you could try

String.prototype.escapeHTML = function () {
  return(
    this.replace(/>/g,'&gt;').
         replace(/</g,'&lt;').
         replace(/"/g,'&quot;')
  );
};
var codeEl = document.getElementById('test');
if (codeEl) {
  codeEl.innerHTML = codeEl.innerHTML.escapeHTML();
}
  Permalink  
Comments
Tech Code Freak 8-Mar-12 3:53am
   
5up!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.170118.1 | Last Updated 8 Mar 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100