Based on Calling ASP.NET MVC Action Methods from JavaScript I've attempted to update a cookie message using ASP.NET Core by :
replacing
hrefbywindow.location.hrefandspecifying
ActionName+ControllerName.I've also tried
window.location.href = '@Url.Action("Action", "Controller")
[Problem] : When clicking on the link, 1-3 redirect to https://www.cookiesandyou.com/, instead of https://localhost/ControllerName/ActionName . Please see below a sample code:
window.cookieconsent.initialise({
....
},
"showLink": true,
"content": {
"message": "test ",
"window.location.href": "Dat?Home",
"allow": "Allow"
}
});
Any idea would highly be appreciated.
N.B: Using ASP.NET, this tasks was trivial since href was simply pointing to /Dat.
Best
href: Home/Dat. Problem was when clicking 2x on the same link, URL was point toHome\Home\Dat, hence an exception. So I have to resort to solution posted which was strangely pointing cookiesandyou.comwindow.location.href: Home/Datpoints to cookiesandyou.com for unknown reasons. Unfortunately href = '@Url.Action("Action", "Controller") does not work and wonder whether a solution involving href could exist