Home Error 500 internal server error in asp.net
Reply: 0

Error 500 internal server error in asp.net

user1215 Published in March 24, 2018, 5:44 pm

I am writing an asp.net application and am trying to make a post request using jquery ajax to web api2 controller method. Doing so results in error 500 internal server error. Here is the jquery code

function reload(quantity, cartItemId) {
            url: "/api/user/UpdateCart",
            method: "POST",

            data: { quantity: quantity, cartItemId:cartItemId },
            success: function() {
              //  window.location.href = "/user/ViewCart";


    function addItem(cartItemId) {
        var quantity = parseInt(document.getElementById("txt-box-" + cartItemId).value);
        document.getElementById("txt-box-" + cartItemId).value = quantity;

In my web api 2 controller I have the following code

    public IHttpActionResult UpdateCart([FromBody]int quantity,[FromBody]int cartItemId)
        var cartItemInDb = _unitOfWork.CartItemRepository.Read(cartItemId);
        cartItemInDb.Quantity = quantity;

        return Ok();
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.302908 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO