![](/img/trans.png)
[英]HTTP ERROR : 405(This page isn't working) When I Refresh The Page(ASP.Net Core MVC)
[英]HTTP ERROR 405 | [HttpPost] ASP.NET MVC Core 3.1
所以事情是這樣的:
我有兩頁,
這是我的代碼,
頁面選擇供應商:
var link = '@Url.Action("UserManagement", "Home", new { GB = @ViewBag.GB, id = "code" })';
link = link.replace("code", listSuppliers[i].Item2);
suppliersTable.row.add([
"<form action='" + link + "'><button type='submit' class='btn btn-primary'>" + listSuppliers[i].Item3 + " account(s)</button></form>" //Number of accounts, clickable to see all accounts
]).draw(false);
控制器 :
[HttpPost]
public ActionResult UserManagement(string GB, string id)
{...
return View();
}
問題是當我點擊我的供應商時,頁面UserManagement顯示:“如果問題仍然存在,則此頁面不起作用聯系網站所有者 HTTP 錯誤 405 ”
我真的不明白,有人可以幫我嗎?
為什么要創建一個表單以轉到鏈接? 為什么不直接使用路由或查詢字符串構建一個 GET URL?
無論如何,默認情況下使表單 POST 是 MVC 功能。 如果你沒有在 HTML 中指定方法,那么它就是一個 GET。 你可以在 F12 中看到這一點。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.