本文介绍了在从主Web应用程序的另一个ASP.NET应用程序自动记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我运行一个文件夹中的最新版本YetAnotherForum我的主要WebApplication的下方。子文件夹被配置为在IIS应用程序并导航到文件夹和奇妙的作品记录。 YAF是设置有会员提供商和使用窗体身份验证。

我想要现在做的是自动登录用户进入从主网站的论坛。主要网站使用通过会议和饼干自定义验证。它不使用任何内置的ASP.NET验证或会员组成。

所以基本上我希望发生的是,当一个链接,用户点击进入论坛,他们发送到他们的身份验证进入YAF应用程序发送他们到子文件夹之前处理页面。

尽管主应用程序不使用内置的认证件,我仍然设置的认证方式为形式,并确信下面的标签相匹配的在web.config中YAF。然后,在处理网页上我打电话FormsAuthentication.SetAuthCookie(用户名,真实),然后重定向。但YAF踢我回到登录页面反正。不知道在哪里,从这里走。

主要网站是:
example.com /

web.config中:

 <身份验证模式=表格>
  <形式的名称= =保护所有超时=43200无Cookie =UseCookies/&GTYAFNET_Authentication。
< /认证>

YAF是:
example.com/yaf(单独的WebApplication在IIS)

的web.config

 <身份验证模式=表格>
  <形式的名称= =保护所有超时=43200无Cookie =UseCookies/&GTYAFNET_Authentication。
< /认证>

处理页面:(伪)
example.com/autoLogin.aspx.cs

 公共无效AutLogin(){
    字符串username = doStuffToGetUsername();
    YAFStuff.CreateUserIfNeeeded(用户名);    FormsAuthentication.SetAuthCookie(用户名,真实);
    的Response.Redirect(/ YAF /);
}


解决方案

我一直在寻找谷歌2天试图排序了这一点,但我终于迷迷糊糊到了解决方案。我需要这两个web.config文件中匹配的加密处理的machineKey。

http://forum.yetanotherforum.net/yaf_postst8780_Custom-membership-and-role-provider-with-YAF-Profile-provider.aspx

甜蜜!

I'm running the latest version of YetAnotherForum in a folder beneath my main WebApplication. The subfolder is configured as an application in IIS and navigating to the folder and logging in works wonderfully. YAF is setup with a membership provider and uses Forms Authentication.

What I'm trying to do now is to auto login a user into the forum from the main website. The main website uses custom authentication through sessions and cookies. It doesn't use any of the built in ASP.NET authentication or membership components.

So basically what I want to happen is that when a user click on a link to access the forums, they're sent to a processing page that authenticates them into the YAF Application before it sends them over to the subfolder.

Even though the main app doesn't use the built in authentications pieces, I've still set the authentication mode to forms and made sure the tag beneath that matches the one in the YAF web.config. Then, on the processing page I'm calling FormsAuthentication.SetAuthCookie(username, true), then redirecting. But YAF kicks me back to the login page anyway. Not sure where to go from here.

Main site is:example.com/

web.config:

<authentication mode="Forms">
  <forms name=".YAFNET_Authentication" protection="All" timeout="43200" cookieless="UseCookies" />
</authentication>

YAF is:example.com/yaf (Seperate WebApplication in IIS)

web.config

<authentication mode="Forms">
  <forms name=".YAFNET_Authentication" protection="All" timeout="43200" cookieless="UseCookies" />
</authentication>

Processing page is: (in pseudo)example.com/autoLogin.aspx.cs

public void AutLogin(){
    string userName = doStuffToGetUsername();
    YAFStuff.CreateUserIfNeeeded(userName);

    FormsAuthentication.SetAuthCookie(userName, true);
    Response.Redirect("/yaf/");
}
解决方案

I'd been searching Google for 2 days trying to sort this out, but I finally stumbled onto the solution. I needed a MachineKey that matched on both web.config files for the encryption process.

http://forum.yetanotherforum.net/yaf_postst8780_Custom-membership-and-role-provider-with-YAF-Profile-provider.aspx

Sweet!

这篇关于在从主Web应用程序的另一个ASP.NET应用程序自动记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-24 11:56