【记录】ASP.NET MVC 4/5 Authentication 身份验证无效
2024-09-18 03:27:58
在 ASP.NET MVC 4/5 应用程序发布的时候,遇到一个问题,在本应用程序中进行身份验证是可以,但不能和其他“二级域名”共享,在其他应用程序身份验证,不能和本应用程序共享,示例代码:
System.Web.Security.FormsAuthentication.SetAuthCookie("蟋蟀", true);
webconfig 配置如下:
<system.web>
<pages validateRequest="false"></pages>
<authentication mode="Forms">
<forms name=".DottextCookie" domain=".test.com" loginUrl="~/Account/Login" protection="All" />
</authentication>
<compilation debug="true" targetFramework="4.5.1" />
<httpRuntime targetFramework="4.5.1" requestValidationMode="2.0" />
</system.web>
比较“奇葩”的解决方式是:把 httpRuntime 节点中的“targetFramework="4.5.1"”去掉就好了,HttpRuntime.TargetFramework 属性参考:system.web.httpruntime.targetframework,感觉应该是应用程序的 Framework 版本和服务器 Framework 版本不一致所引起的,至于具体原因,尚不得知!
最新文章
- div实现自适应高度的textarea,实现angular双向绑定
- UIAlertController 部分用法及属性
- B样条基函数(cubic spline basis)
- Archlinux 上 Nginx + PHP + Mariadb + DiscuzX2.5 安装小记
- win10 EFI装ubuntu14.04双系统 及初始配置
- iOS xcode6 添加.pch文件
- Login 页面
- ASP.NET jquery ajax传递参数
- Jquery异步请求简单实例(转)
- 文字超出DIV的边框
- Objective-C学习篇03—继承
- 项目.c文件和.h文件关系
- Hadoop hdfs上传文件 权限问题
- 【linux之软件安装,rpm,yum】
- linux中probe函数中传递的参数来源(上)
- java内部类(转)
- 42028: Assignment 1 – Autumn 2019
- W3School 学习笔记
- ubuntu14.04上设置默认python命令是执行python3而不是Python2
- Python常用模块-时间模块(time&;datetime)
热门文章
- 使用nodeJs安装Vue-cli
- Python之路【第二篇】python基础 之基本数据类型
- Swift 3 and OpenGL on Linux and macOS with GLFW
- 手把手教android studio中安装Android Butterknife Zelezny (转)
- python网页抓取练手代码
- 搭建Linux+Jexus+MariaDB+ASP.NET[LJMA]环境
- ubuntu-14.04.2-desktop使用方法
- .NET中异常处理的最佳实践(译)
- 配置NHibernate将枚举保存为Oracle数据库中的字符串
- awk神器