Solved

How to save the HTML formatted Text with Page Validation.

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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Trigger C# code inside the SQL Server 6 57
Data Analysis 7 59
SQL State HYT00. Timeout expired proplem 8 43
SQL query joining 6 tables in asp.net 4 28
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

734 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