0

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 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.