Dindar
Dindar

Reputation: 3235

Yet another forum password issue

I have an asp.net web-from application which uses ASP.NET membership provider . Beside this I have yet another forum website in sub-domain. I would like when user register in my site , it automatically register in forum , too . By another word when user register in my site , it can use that credential for loging-in to forum as well .

So , when ever a user register in my site , I add a record in yaf_User table too . But the problem is although there is a password field at yaf_User , YAF Doesn't save password at that field . I don't know where does YAF saves passwords ?

Upvotes: 1

Views: 1747

Answers (4)

Naphong
Naphong

Reputation: 46

Naphong, I have done with automatic-login asp.net membership In First Web Application 1. fill in web.config

<machineKey validationKey="282487E295028E59B8F411ACB689CCD6F39DDD21E6055A3EE480424315994760ADF21B580D8587DB675FA02F79167413044E25309CCCDB647174D5B3D0DD9141" decryptionKey="8B6697227CBCA902B1A0925D40FAA00B353F2DF4359D2099" validation="SHA1"/>
  1. Login Page I have defined at [WebApplication1]/login.aspx] Login Authenticate fill in event :

    FormsAuthentication.SetAuthCookie([username], false); System.Web.HttpCookie MyCookie =System.Web.Security.FormsAuthentication.GetAuthCookie(User.Identity.Name.ToString(),false); MyCookie.Domain = "127.0.0.1";//the second level domain name //I try to my computer after publish my site Response.AppendCookie(MyCookie);

In Second WebApplication 1. web.config

That's all my solution with Single Sign On with Membership of YAF or other web site.

You can ask me if you can't solve this problem, [email protected]

Upvotes: 0

Jaben
Jaben

Reputation: 426

YAF.NET uses ASP.NET membership (as well as roles and profile) as a master. The yaf_user table is just a forum-specific slave that is updated automatically. The password field in that table is legacy and can be ignored. YAF doesn't care about passwords anymore. If the user is logged in, the forum is happy. So, as long as your membership and forms authentication ticket match up on both your main and YAF sub-domain, you shouldn't have any problems.

Upvotes: 2

Mikael Svenson
Mikael Svenson

Reputation: 39695

A better and easier solution would be to use the same membership provider for both the web application and the forum (which I assume is also using the membership provider). Since you want the same username for both the app and the forum, why not just use the same user database?

As for the password, default it is encrypted and not clear text. Check the enablePasswordRetrieval of your provider setting in web.config.

In web.config for both apps set the domain attribute to the top level domain:

<authentication mode="Forms">
  <forms loginUrl="~/Account/Login.aspx" timeout="2880" domain="toplevel.com"  />
</authentication>

This ensures that if you log in on either the app or the forum, you will automatically be logged in to the other as well.

Upvotes: 2

Related Questions