问题描述
我有一个MVC 5应用程序,在.NET 4.6和MVC 5.2.3下开发,当我在我的机器上的Chrome和Edge中调试时,它可以100%工作。当我部署到我的ISP的共享主机时,它会在第一个请求之后给出以下错误,该请求成功并显示登录页面。
403 - 禁止访问:访问被拒绝。您无权使用您提供的凭据查看此目录或页面。
然后,如果我清除名为的cookie .AspNet.ApplicationCookie来自Chrome的
,然后下一个请求成功,但cookie又回来了,所有后续请求都以同样的方式失败。
我不是在我自己的任何代码中使用应用程序状态,我添加到标准VS2015项目模板附带的软件包的唯一包是:
AutoMapper
elmah。 corelibrary
Elmah.Mvc
Unity
Unity.Mvc5
如果我做得正确,当我在边缘检查cookie时,没有这样的cookie,只有 __ RequestVerificationToken
,它在Chrome中没有任何作用(在这个问题的范围之外)。
我尝试了什么:
与ISP签订了支持电话,但36小时后仍无响应。
使用< elmah> web.config中的节点,尝试添加:
< security allowRemoteAccess =true/>
I have an MVC 5 app, developed under .NET 4.6 and MVC 5.2.3 that works 100% when I debug it in Chrome and Edge on my machine. When I deploy to shared hosting at my ISP, it gives the following error on every request after the very first one, which succeeds and shows the login page.
403 - Forbidden: Access is denied. You do not have permission to view this directory or page using the credentials that you supplied.
Then if I clear a cookie called .AspNet.ApplicationCookie
from Chrome, then the next request succeeds, but the cookie is back and all subsequent requests fail in the same manner.
I am not using application state in any of my own code, and the only packages I have added to those that come with the standard VS2015 project template are:
AutoMapper elmah.corelibrary Elmah.Mvc Unity Unity.Mvc5
If I've done this correctly, when I check for cookies in Edge, there no such cookie, only the __RequestVerificationToken
, which plays no role (outside the scope of this question) in Chrome.
What I have tried:
Logged a support call with the ISP, but 36 hours later still no response.
<security allowRemoteAccess="true" />
这篇关于为什么aspnet cookie会导致HTTP 403错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!