Solved

How to save the HTML formatted Text with Page Validation.

Posted on 2014-01-07
3
307 Views
Last Modified: 2014-01-22
Hi,
I am trying to save the HTML formatted Text entered in the Text Box into Data Base through stored procedure.Ex:<b>,<br/><i> Tags
I am getting the potentially dangerous request error.
I am doing the page validation. I can't go without page validation.
How to save the HTML formatted Text to DataBase with Page Validation.

Thanks
0
Comment
Question by:KavyaVS
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 9

Accepted Solution

by:
s_chilkury earned 350 total points
ID: 39763460
This is referred as Request Validation - http://msdn.microsoft.com/library/hh882339(v=vs.100).aspx

When you are sure that you will use HTML-encode everywhere then pass strings to HTML and then set Page's validateRequest="false"

AND

If you are on .net 4.0 make sure you add this in your web.config
Inside the <system.web> tags

<httpRuntime requestValidationMode="2.0" />

Check this out:
http://forums.asp.net/t/1634650.aspx?Potentially+Dangerous+Request+Form+Error
0
 
LVL 4

Assisted Solution

by:ItWorked
ItWorked earned 150 total points
ID: 39764439
The above solution provided by @s_chilkury will work fine...but not recommended..

The reason is you are opening a security breach.

Instead of that what you can do is Use some sort of JavaScript that will encode your HTML at client side and send it to the server. Save the same in DB with SP which won't cause any problem and when ever you are getting it back from DB you can Decode it.

while taking such decision make sure to keep in mind
as You also need to check it at Server side...


IF you are ok with that, then Above solution provided by @s_chilkury will work fine
0
 

Author Closing Comment

by:KavyaVS
ID: 39800636
Thanks
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question