70511

JSON parameters auto. convert to lowercase when ajax request made to MVC action method?

Question:

Would anybody know why my parameter is being "converted" to lowercase when it hits my ASP.NET MVC controller action?

I can only assume it is being converted as looking at data value just prior to the ajax request it is in correct casing, but then when debugging my action method within .NET during the ajax request and checking the incoming parameter, it has been converted to lowercase?

This is causing dramas for me as I need to keep the case entered by the user.

Code below, example data being sent is: 'SimpleDATATest1'

$.ajax({ type: "GET", url: "/configuration/module-message-types/GetTranslation", data: "messageToTranslate=" + messageToTranslate, dataType: "json", success: function(result) { // Insert the returned HTML into the <div>. $('#TranslationResponse').html(result.message).fadeIn('fast'); $("#" + ajaxLoadImgId).hide(); }, error: function(req, status, error) { $('#TranslationResponse').text('Could not load example translation message, please try reloading the page.'); $("#" + ajaxLoadImgId).hide(); } });

And MVC Action method signature is:

[AcceptVerbs(HttpVerbs.Get)] public JsonResult GetTranslation(string messageToTranslate)

However, when checking the value of 'messageToTranslate' it is returning as: 'simpledatatest1'.

How can I stop whatever forces at work from changing this?

Answer1:

Nevermind... I found this that I implemented was the culprit:<br /><a href="http://www.coderjournal.com/2008/03/force-mvc-route-url-lowercase/" rel="nofollow"></a><a href="http://www.coderjournal.com/2008/03/force-mvc-route-url-lowercase/" rel="nofollow">http://www.coderjournal.com/2008/03/force-mvc-route-url-lowercase/</a>

Recommend

  • ER Diagram that implements Actors Database [closed]
  • Type mismatch: cannot convert from Connection to Connection
  • Drag and Drop for imageview not working
  • Spring Cloud Microservice Architecture Confusion
  • How do I exclude a dependency in provided scope when running in Maven test scope?
  • Is there a perl module to validate passwords stored in “{crypt}hashedpassword” “{ssha}hashedpassword
  • MailKit: The IMAP server replied to the 'EXAMINE' command with a 'BAD' response
  • Dialing with Intent.ACTION_CALL stopps at # in phone number
  • Meteor helpers not available in Angular template
  • Highlight one bar in a series in highcharts?
  • Lost migrations and Azure database is now out of sync
  • How can I send an e-mail from a vbs script
  • Is there any way to access browser form field suggestions from JavaScript?
  • Android screen density dpi vs ppi
  • Dynamically accessing properties of knockoutjs observable array
  • script to move all files from one location to another location
  • WinForms: two way TextBox problem
  • Can I make an Android app that runs a web view in Chrome 39?
  • How to make Safari send if-modified-since header?
  • How to pass list parameters for each object using Spring MVC?
  • Circular dependency while pushing http interceptor
  • Is there a mandatory requirement to switch app.yaml?
  • AngularJs get employee from factory
  • How can I get HTML syntax highlighting in my editor for CakePHP?
  • using HTMLImports.whenReady not working in chrome
  • How to set the response of a form post action to a iframe source?
  • How do I configure my settings file to work with unit tests?
  • Setting background image for body element in xhtml (for different monitors and resolutions)
  • Change div Background jquery
  • Turn off referential integrity in Derby? is it possible?
  • IndexOutOfRangeException on multidimensional array despite using GetLength check
  • Authorize attributes not working in MVC 4
  • How can I remove ASP.NET Designer.cs files?
  • JaxB to read class hierarchy
  • Busy indicator not showing up in wpf window [duplicate]
  • Binding checkboxes to object values in AngularJs
  • UserPrincipal.Current returns apppool on IIS
  • Python/Django TangoWithDjango Models and Databases
  • java string with new operator and a literal
  • Net Present Value in Excel for Grouped Recurring CF