Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7969577
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:15:28+00:00 2026-06-04T07:15:28+00:00

i installed yet another forum(yaf) code successfully and integrated it with blog engine 2.0

  • 0

i installed yet another forum(yaf) code successfully and integrated it with blog engine 2.0 successfully.Now I wanted to have the common login for both blog engine 2.0 and yaf i.e when i login for blogengine2.0 automatically yaf has to be logged in .Can anyone suggest me the solution?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T07:15:29+00:00Added an answer on June 4, 2026 at 7:15 am

    Change the MembershipPorivder in the webconfig to the following:

    //I have changaned the following to be able to genrate a password myself and to be    able to retrive it when i want to login the use, you can change this if you want or just leave it as it is.
    <membership defaultProvider="YafMembershipProvider" hashAlgorithmType="NONE" >
            <providers>
                <clear/>
                <add connectionStringName="yafnet" applicationName="YetAnotherForum" name="YafMembershipProvider" passwordFormat="Clear" requiresUniqueEmail="true" useSalt="false" enablePasswordRetrieval="true" type="YAF.Providers.Membership.YafMembershipProvider"/>
            </providers>
        </membership>
    

    This method here will create a YAFUser, all these methods are extracted from code the YAF library i just worked a lot on them to extract everything i want:

        /// <summary>
        /// Register YAF User
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="password"></param>
        /// <param name="email"></param>
        /// <param name="displayName"></param>
        public static MembershipUser RegisterYAF_User(string userName, string password, string email, string displayName)
        {
            //Intilize YAFMembershipProvider
            MembershipCreateStatus status;
            YafMembershipProvider provider = new YafMembershipProvider();
            NameValueCollection valueCollection = new NameValueCollection();
            valueCollection.Add("connectionStringName", "yafnet");
            valueCollection.Add("applicationName", "YetAnotherForum");
            valueCollection.Add("passwordFormat", "Clear");
            provider.Initialize("YafMembershipProvider", valueCollection);
    
            //Register YAFMembershipUser
            MembershipUser user = provider.CreateUser(userName, password, email, "What is your favorite football team ?", "None", true, new YAF.Providers.Profile.DB().GetProviderUserKey("YetAnotherForum", userName), out status);
    
            //Register YAFUser
            if (user != null)
            {
                //Add user to role
                RoleMembershipHelper.AddUserToRole(user.UserName, "Registered");
    
                // setup inital roles (if any) for this user
                RoleMembershipHelper.SetupUserRoles(YafContext.Current.PageBoardID, userName);
    
                // create the user in the YAF DB as well as sync roles...
                int? userID = RoleMembershipHelper.CreateForumUser(user, user.UserName, YafContext.Current.PageBoardID);
    
                // create empty profile just so they have one
                YafUserProfile userProfile = YafUserProfile.GetProfile(user.UserName);
    
                // setup their inital profile information
                userProfile.Location = "USA";
                userProfile.Homepage = string.Empty;
                userProfile.Save();
    
                     LegacyDb.user_save(
                UserMembershipHelper.GetUserIDFromProviderUserKey(user.ProviderUserKey),
                YafContext.Current.PageBoardID,
                null,
                null,
                null,
                YafContext.Current.TimeZoneUser.ToType<int>(),
                null,
                null,
                null,
                null,
                null,
                null,
                null,
                null,
                null,
                null,
                null);
                 }
    
            return user;
        }
    

    This function is used to Login the YAFUser:

            //Login yaf user
        /// <summary>
        /// Login
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="password"></param>
        public static void LoginYAF_User(string userName, string password)
        {
            MembershipCreateStatus status;
            YafMembershipProvider provider = new YafMembershipProvider();
            NameValueCollection valueCollection = new NameValueCollection();
            valueCollection.Add("connectionStringName", "yafnet");
            valueCollection.Add("applicationName", "YetAnotherForum");
            valueCollection.Add("passwordFormat", "Clear");
            provider.Initialize("YafMembershipProvider", valueCollection);
    
            bool Authenticated = false;
            if (provider.ValidateUser(userName, password))
            {
                Authenticated = true;
                FormsAuthentication.SetAuthCookie(userName, true);
            }
            else if (new YafBoardSettings().EnableDisplayName)
            {
                var id = new DefaultUserDisplayName(YafContext.Current.ServiceLocator).GetId(userName);
    
                if (id.HasValue)
                {
                    // get the username associated with this id...
                    userName = UserMembershipHelper.GetUserNameFromID(id.Value);
    
                    // validate again...
                    if (provider.ValidateUser(userName, password))
                    {
                        Authenticated = true;
                    }
                }
            }
    
            //These 2 lines of code is to redirect to the fourm main page
            //YafContext.Current.Get<IRaiseEvent>().Raise(new SuccessfulUserLoginEvent(YafContext.Current.CurrentUserData.UserID));
            //YafBuildLink.Redirect(ForumPages.forum);
        }
    

    After that go to YAFMembershipProvider.cs and add an overload method like the following:

        public string GetPassword(string username)
    {
        // Check for null arguments
        if ((username == null))
        {
            ExceptionReporter.ThrowArgument("MEMBERSHIP", "USERNAMEPASSWORDNULL");
        }
    
        UserPasswordInfo currentPasswordInfo = UserPasswordInfo.CreateInstanceFromDB(
          "YetAnotherForum",
          username,
          false,
          this.UseSalt,
          this.HashHex,
          this.HashCase,
          "",
          this.MSCompliant);
    
        return currentPasswordInfo.Password;
    }
    

    In this i have given a 99% percent, the rest is just plain simple coding, as for the blog you should use the same concept. Search through the DataLayer and get all the methods that you need to sync between as many applications as you want.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i installed yet another forum code successfully.But when i tried to integrate it with
I've got yet another deployment problem. What I have: little Windows Forms application that
I have Eclipse Galileo (for Java EE Developers) installed, and I'm now trying to
I have an iPhone application that is not yet released but I wanted to
Hello good people of Stack Overflow, I have come with yet another question for
I installed all the necessary packages for running GUI programs in Cygwin. Right now,
Alright, I presented this question on the MSDN forums but have yet to receive
This is yet another Unit Testing question. I'm trying to draw knowledge from a
I'm creating a simple chat app. Have installed nginx on Ubuntu 11.10, with PHP
So I have spent the past 11 hours now trying to get even the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.