Solved

How to save the HTML formatted Text with Page Validation.

Posted on 2014-01-07
3
301 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
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

815 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now