Click here to Skip to main content
15,891,708 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I am facing this error as when i inserting the text for the first time its working fine but when i try to edit the text by clicking on editbtn and then the code will change the to edit panel and bind the text of this job (note when i click on edit and code binding the text it will show into text as it has been stored into database) and when i finish editing and click on update then i am finding this error.

When User Inserting texts for first time code:

C#
  string CompInfo = AboutComptxtbx.Text;
                CompInfo = CompInfo.Replace(System.Environment.NewLine, "<br />");
//...
cmd.Parameters.AddWithValue("@EmpOvViw", CompInfo);


When user click on To edit the job, (binding the texts from table inside database to textboxes)
C#
string EditCompInfo = EditJobEmpOvViwtxtbx.Text;
            EditCompInfo = EditCompInfo.Replace(System.Environment.NewLine, "<br />");
//...

EditJobcmd.Parameters.AddWithValue("@EmpOvViw", EditCompInfo);

The error message:
A potentially dangerous Request.Form value was detected from the client (ctl00$ContentPlaceHolder1$EditJobEmpOvViwtxtbx="...rritories.<br /><br />The curr...").
Posted
Updated 23-Sep-15 15:39pm
v3

1 solution

I don't think, you need the replacing here. Please remove those lines which includes br tag. Moreover, br tags are not recommended.
 
Share this answer
 
Comments
Member 10690878 23-Sep-15 23:43pm    
@Tadit Dash (ତଡିତ୍ କୁମାର ଦାଶ) but did there are any others way to save the text as user inserted i mean with newline !!!
What it does if you don't add anything for new line and save directly?
Member 10690878 24-Sep-15 7:48am    
I may not understand what you mean excatly , but if i dont add anything then all the text written in one Textbox will be in on line.
Then I would suggest to add a textarea instead of textbox. That will support new line by default. No need to do anything.

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900