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

Does anyone know why my parameter is "converted" to lowercase when it hits my ASP.NET MVC controller action?

I can only assume that it is being converted by considering the data value just before the ajax request is in the correct body, but then when we debug my action method in .NET during the ajax request and check the input parameter, it has been converted to lower case?

This is causing drama for me since I need to keep the user-entered case.

Code below sending example data: ' 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 the signature of the MVC Action method:

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

      

However, when checking the value of 'messageToTranslate', it returns as: ' SimpleDATATest1

'.

How can I stop any forces at work to change this?

0


source to share


1 answer


Nevermind ... I found that I implemented this offender:
http://www.coderjournal.com/2008/03/force-mvc-route-url-lowercase/



+1


source







All Articles