从另一个端口验证 ASP.NET Core 应用程序

发布于 2025-01-10 18:00:08 字数 260 浏览 4 评论 0原文

我有一个 asp.net core MVC 应用程序和一个 SPA 前端。我的 asp.net core MVC 应用程序在 44747 端口上运行,我的 SPA 应用程序在端口 3000 上运行。

从 MVC 登录后,我可以看到我的身份验证 cookie 在这些域之间共享,并且它使用 cors。

当我的 SPA 前端尝试发布操作时,它只是返回 302 重定向到登录页面。

如何让我的 MVC 接受 SPA 的 cookie 并保持其身份验证(至少对于开发模式)

I have an asp.net core MVC application and an SPA front-end. my asp.net core MVC application works on 44747 port, and my SPA application works on port 3000.

I can see my authentication cookies are shared among these domains after signing in from MVC, and it's using cors.

when my SPA front-end tries post to an action, it simply returns a 302 redirect to login page.

How can I make my MVC accept the cookies from SPA and keep it authenticated (At least for development mode)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文