Editing multiple rows with an ' in a column values gives me an error
Editing multiple rows with an ' in a column values gives me an error
When editing multiple records and one column value has an ' in it, the editor will return an error of A potentially dangerous Request.Form value was detected from the client (data[row_1837][Dealership_Names]="ej's air condition...").'
Also when editing multiple rows with an & the & is replaced with @amp.
I am unable to get debug information due to this error. If I edit the row one at a time it works just fine. I am not sure what to do with this.
I could not find a place to add a test case for editor, if there is one I am happy to use it.
Answers
Hi,
For the first part, checkout this SO post. It is because of the validation being performed. Depending on what .NET methodology you are using and what version, how to resolve it will differ.
For the second part, have a look at this part of the Editor security manual. It does automatic XSS protection by encoding entities. That might not always be desired, so you can turn it off. If you do so, make sure you use a text renderer in DataTables to protect against XSS attacks.
Allan
I tried the suggestions from both articles and it still gives me the error. Would you like me to post my code and if so which parts?
Can you show me your .NET controller please?
Allan
function getContactsExportTable() {
}
<body>
<table id="ContactsExportTable" class="table table-striped table-bordered dt-responsive ">
<thead>
<tr id="filterContactExportboxrow">
<th>id</th>
<th>Contact id</th>
<th>Account</th>
<th style="min-width:400px;">Dealership Names</th>
<th>Branch</th>
<th>Submitted Date</th>
<th>Terms</th>
<th>Due Date</th>
<th>MKTMGR</th>
<th>MFType</th>
<th>Reference</th>
<th>Dealer Type</th>
<th>YEAR</th>
<th>Gross Total</th>
<th>Discount Rate</th>
<th>New Total</th>
</tr>
</thead>
</table>
</body>
This is for WebAPI is it? What version of .NET are you using?
In addition to adding this attribute to the controller:
This SO thread suggests that you need to modify the
web.config
file as well.Allan
I am using 4.7.2
I have the suggestion from the https://stackoverflow.com/questions/807662/why-is-validateinputfalse-not-working
Oh! You are using .NET Framework? Does the solution from the last SO thread you posted work for you?
Allan
No, it did not
I know I should upgrade to ASP Core, having a hard time finding the time. I am on 6 web projects, managing two programmers and I am the only DBA. My goal is to upgrade to ASP Core sometime this year.
Haha - I have goals for this year as well. Let's compare notes for how far we got in January 2025
Try this one from the SO thread. It specifically is talking about .NET 4.
Allan