Frage

I have this link

@Ajax.RouteLink("Bid", RouteNames.Ajax.BidOnLot,
            new
            {
                lotId = Model.Lot.Id,
                bidAmount = Model.NextBidAmountForUser
            },
            new AjaxOptions
            {
                HttpMethod = "POST",
                OnFailure = "OnFailure",
                OnSuccess = "OnSuccess"
            })

and this action method

[AjaxOnly, HttpPost]
        [Route("ajax/bid-on-lot/{lotId}/{bidAmount}", Name = RouteNames.Ajax.BidOnLot)]
        [Authorize]
        public JsonResult Bid(string lotId, decimal bidAmount)

RouteNames.Ajax.BidOnLot is set to "BidOnLot"

But for some reason when I click on the link, I get a 404 with this message.

404 Not Found - http://localhost:12472/ajax/bid-on-lot/lot-901/210.0

When I have only the LotId parameter everything works normally but adding an additional parameter makes it all fail.

Why is this happening?

War es hilfreich?

Lösung

Just in case anyone else struggles with this in the future let me tell you what the issue was. Passing a decimal parameter was the issue. Passing an int, double or string is fine but when I made it a decimal it failed.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top