基于 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
。
最佳
答案 0 :(得分:0)
最终,使用:
"href: '/Home/Dat',"
解决了我的问题:没有自动指向cookiesandyou.com,并且点击n
次链接没有指向Home\...\Dat
,因此由于插入了{{1}而产生错误}.
最好的。