views:

636

answers:

1

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?

+1  A: 

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

GONeale