基于 Calling ASP.NET MVC Action Methods from JavaScript,我尝试使用 cookie
更新 ASP.NET Core
消息:
-
用
替换href
和window.location.href
-
指定
actionName
+ControllerName
。 -
我也试过
window.location.href = '@Url.action("action","Controller")
[问题]:点击链接时,1-3
重定向到 https://www.cookiesandyou.com/,而不是 https://localhost/ControllerName/actionName。请参阅下面的示例代码:
window.cookieconsent.initialise({
....
},"showLink": true,"content": {
"message": "test ","window.location.href": "Dat?Home","allow": "Allow"
}
});
任何想法将不胜感激。
注意:使用 ASP.NET
,这个任务很简单,因为 href
只是指向 /Dat
。
最佳