Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8333889
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T03:10:13+00:00 2026-06-09T03:10:13+00:00

I am using Json to send update information to the following controller action: [HttpPost]

  • 0

I am using Json to send update information to the following controller action:

    [HttpPost]
    public JsonResult JsonUpdate(string pk, string rk, string fld, string val) {
        Content content = null;
        try {
            if (fld == "TempRowKey") {
                content = contentService.Get(pk, rk);
                rk = utilityService.DotFormatToRowKey(val);
                contentService.UpdateRowKey(content, rk, User.Identity.Name);
            } else {

I realize it’s an added protection in MVC that’s causing the problem but I need to be able to pass HTML code in the val argument and I am getting the following error:

A potentially dangerous Request.Form value was detected from the client (val="...e HashMap <K,V>, LinkedHashMap..."). 

Note that the is valid text that an admin person entered. This screen is only used by admins and so I am okay with no protection for the field.

Looks like there were some changes between MVC2, 3 and 4.

What are the ways I can avoid this problem with MVC3 and MVC4. I saw there’s another post like mine on stackoverflow but it does not really address the problem.

Note I am looking for something local that I can apply to just this action. I saw some suggestions on the web but it looks like there’s confusion between how to handle this with the different MVC versions. Is the best way to encode and decode the data and if so how could I do that?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T03:10:15+00:00Added an answer on June 9, 2026 at 3:10 am
    [ValidateInput(false)]
    public JsonResult JsonUpdate(string pk, string rk, string fld, string val)
    {
        ...
    

    However, you should be able to do something like this as well:

    public class MyJsonUpdateModel
    {
        public string pk { get; set; }
        public string rk { get; set; }
        public string fld { get; set; }
    
        [AllowHtml]
        public string val { get; set; }
    }
    
    // [ValidateInput(false)] not needed because model states HTML is allowed
    public JsonResult JsonUpdate(MyJsonUpdateModel model)
    {
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using $.ajax asynchronously to send some json to a controller marked with [HttpPost],
we would like to send a JSON update command to twitter, but only using
I am using JSON-RPC. When i send request to server i get a response
I'm using XStream and JETTISON's Stax JSON serializer to send/receive messages to/from JSON javascripts
I'm using asp.net mvc2 and trying to send a list of json objects with
Good morning, I am trying to pass a string to twitter, using the following
I'm using jQuery and Codeigniter to update the database via AJAX. The following code
I'm using this function to send json to a php page: function update_records(data) {
I am using $.post() to send a json to my cfc, which updates some
Using JSON.stringify and JSON.parse to serialize and deserialize objects has subtle problems such as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.