【发布时间】:2019-06-08 14:51:17
【问题描述】:
网址将是http://localhost:54088/UserAdmin/FindUser?UserId=COMPANY%5Ckarimf “/”应用程序中的服务器错误。 无法找到该资源。 说明:HTTP 404。您要查找的资源(或其依赖项之一)可能已被删除、名称已更改或暂时不可用。请查看以下 URL 并确保其拼写正确。
请求的 URL:/UserAdmin/FindUser
控制器
public ActionResult FindUser(string UserId)
{
User user = db.Users.Find(UserId);
return View(user);
}
查看
@if (Request.IsAuthenticated && User.IsInRole("Edit-Content")) {
@Html.ActionLink("Edit", "FindUser", "UserAdmin",
new { UserId = item.UserId }, new { @class = "btn btn-primary" })} |
@if (Request.IsAuthenticated && User.IsInRole("Delete-Content"))
{
@Html.ActionLink("Delete", "Delete", "UsersAdmin",
new { UserId = item.UserId }, new { @class = "btn btn-danger" })
}
【问题讨论】:
-
前几天遇到了类似的问题,我很确定它与身份验证无关。它与您的控制器或 URL 有关,请考虑检查主机属性
-
我知道控制器路由的问题,我有相同的搜索功能,但我不知道编辑用户有什么问题! @QuestGamer7
标签: c# sql-server asp.net-mvc asp.net-web-api url-routing