我在我的主WebApplication下的一个文件夹中运行最新版本的YetAnotherForum。子文件夹被配置为IIS中的一个应用程序,导航到该文件夹并登录效果非常好。YAF使用成员资格提供程序进行设置,并使用窗体身份验证。
我现在要做的是让用户从主网站自动登录到论坛。主网站通过会话和cookie使用自定义身份验证。它不使用任何内置的ASP.NET身份验证或成员资格组件。
所以基本上我想要发生的是,当用户点击链接访问论坛时,他们会被发送到一个处理页面,在YAF应用程序将他们发送到子文件夹之前,该页面会对他们进行身份验证。
即使主应用程序没有使用内置的身份验证部分,我仍然将身份验证模式设置为forms,并确保其下面的标签与YAF web.config中的标签相匹配。然后,在处理页面上,我调用FormsAuthentication.SetAuthCookie(用户名,true),然后重定向。但YAF还是会把我踢回登录页面。不知道下一步该怎么走。
主站点是: example.com/
web.config:
<authentication mode="Forms">
<forms name=".YAFNET_Authentication" protection="All" timeout="43200" cookieless="UseCookies" />
</authentication>YAF为: example.com/yaf (独立于IIS中的WebApplication )
web.config
<authentication mode="Forms">
<forms name=".YAFNET_Authentication" protection="All" timeout="43200" cookieless="UseCookies" />
</authentication>处理页面为:(伪) example.com/autoLogin.aspx.cs
public void AutLogin(){
string userName = doStuffToGetUsername();
YAFStuff.CreateUserIfNeeeded(userName);
FormsAuthentication.SetAuthCookie(userName, true);
Response.Redirect("/yaf/");
}发布于 2010-02-03 00:24:15
我已经在谷歌上搜索了两天,试图解决这个问题,但我最终偶然发现了解决方案。我需要一个与两个web.config文件都匹配的MachineKey来进行加密。
http://forum.yetanotherforum.net/yaf_postst8780_Custom-membership-and-role-provider-with-YAF-Profile-provider.aspx
甜!
https://stackoverflow.com/questions/2185228
复制相似问题