Click here to Skip to main content
14,735,239 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I know that the variable 'LastSelectedSettingValue' will sometimes contain html tags.
When it is simple text the JSON below works fine. When it contains HTML the JSON below fails. I have tried JSON.Encode() and other things, but without success.

               url: '/StoreAdmin01/UpdateSetting',
               type: 'POST',
               dataType: "json",
               traditional: true,
               async: false,
               data: { settingId: LastSelectedSettingIdValue, settingValue: LastSelectedSettingValue, time: new Date() },
               success: function (result) {

               error: function () {


1 solution

Use Base64 transcoder to encode your string:[^]
Like this:

In Server side, use:
byte[] b = Convert.FromBase64String(yourpostedvalue);
string yourvalue = System .Text.Encoding.UTF8.GetString(b);

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