- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
好吧,我正在使用 netcoreapp2.2 ,并且我已将我的项目配置为使用“BasicAuthentication”,一切似乎都很好。
services.AddAuthentication("BasicAuthentication")
.AddScheme<AuthenticationSchemeOptions, BasicAuthenticationHandler>("BasicAuthentication",null);
但是发生的事情是,无论哪里有 [Authorize],都会使页面返回 401 错误(我看到这对于 BasicAuthentication 来说是正常的),但是如何让它重定向到我的登录 View ?而不是 401?
谢谢
最佳答案
您可以在服务上使用 ConfigureApplicationCookie 扩展来指定登录页面路径。当您收到 401 时,它将自动重定向到那里。
services.ConfigureApplicationCookie(options => options.LoginPath = "pathToLoginPage");
关于c# - 如何使用 BasicAuthentication (c# dotnet core) 将用户重定向到登录页面而不是 401 错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56279249/
我正在尝试完成一个简单的任务:使用 BASIC Auth 保护我的 ASP.NET WEBAPI(建立在 Katana 之上)。我知道我可以实现自己的中间件或消息处理程序或其他任何东西。但是我想知道这
我试用了位于 http://book.cakephp.org/2.0/en/tutorials-and-examples/simple-acl-controlled-application/simpl
我使用 Indy TIdHTTP 通过 BasicAuthentication 进行获取请求。 代码工作正常,但如果用户使用正确的登录密码重新输入凭据并再次发送请求,TIdHTTP 在第一个 401
您好,我想打开这个网址 http://3864.cloud-matic.net/从我的 android webview 中,我尝试了很多方法,但该应用程序甚至没有打开 mainActivity。我尝试
我正在构建一个名为 Git Crx 的 Chrome 打包应用程序,顾名思义,它需要使用 HTTPS(智能协议(protocol))向远程 git repos 发送网络请求,但是如果你尝试对一个 ur
为什么以下结果会导致“未经授权”响应: webClient .getAbs("http://hello.com") .basicAuthenticat
我正在尝试调试不断收到的 System.Web.HttpException。它可能与我正在尝试实现的 BaiscAuthentication 自定义 HttpModule 有关。 BasicAuthe
好吧,我正在使用 netcoreapp2.2 ,并且我已将我的项目配置为使用“BasicAuthentication”,一切似乎都很好。 services.AddAuthent
我是一名优秀的程序员,十分优秀!