1
  function GetUserEditProfileDetails() {
    var res = {};

    res.ID = parseInt($("#User_ID_EditProfile").val());
    res.FirstName = $("#FirstName").val();
    res.LastName = $("#LastName").val();

    res.EmailId = $("#EmailId").val();
    res.Mobile = $("#Mobile").val();
    res.ProfilePic = $(".ProfilePic").attr("src");

    return res;
}

 $.ajax({
        url: "Profile/UpdateUser",             
        async: false,
        type: "POST",
        data: GetUserEditProfileDetails(),
        dataType: "json",
        contentType: "application/json; charset=utf-8",
        error: function (jqXHR, textStatus, errorThrown) {
            alert(JSON.stringify(jqXHR) + "-" + textStatus + "-" + errorThrown);
        }
    })

By using above code, I am trying to save the details of a user. But when the profile pic is too long then the controller method is not calling and it shows internal server error.

3
  • 3
    adjust maxAllowedContentLength to increase the limit Commented Jun 5, 2017 at 4:16
  • 3
    Check your web.config and adjust maxAllowedContentLength in requestLimits element to larger number (maximum is 4,294,967,295 or around 4 GB). Commented Jun 5, 2017 at 4:21
  • Its Working. thanks Commented Jun 5, 2017 at 4:28

1 Answer 1

1

Hi Please check below solution :

You need to change maxAllowedContentLength in Web.Config File :

In system.web :

<httpRuntime maxRequestLength="1048576" executionTimeout="3600" />

And in system.webServer

<security>
    <requestFiltering>
        <requestLimits maxAllowedContentLength="1073741824" />
    </requestFiltering>
</security>

Cheers !!

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.