YAFLogo

cheekykevwalker
13 years ago
Hi all

I have been struggling with ASP.NET membership integration for YAF for a while now and as far as I can see there is no end to end set up guide for doing this. There are a few WIKI entries but nothing complete so I was thinking as this must be such a common issue that between everyone in the YAF community we can come up with a definitive guide for setting up YAF for an out of the box default ASP.NET site that you get when you select New Website in Visual Studio. This is assuming you want the forum to sit within your site as part of a Masterpage / Content page scenario.

Whos with me for attempting it and I will happily write up a finished article at the end. Ill kick things off with what I know so far and the out of the box ASP.NET set up.

1. Open up VS2010

2. Select New Project and select New Website as the project type. For the purposes of this we will call it YAFWebsite

3. You will have the default website structure and your web config file will look something like this.

<?xml version="1.0"?>

<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->

<configuration>
  <connectionStrings>
    <add name="ApplicationServices"
         connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true"
         providerName="System.Data.SqlClient" />
  </connectionStrings>

  <system.web>
    <compilation debug="true" targetFramework="4.0" />

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

    <membership>
      <providers>
        <clear/>
        <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices"
             enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false"
             maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10"
             applicationName="/" />
      </providers>
    </membership>

    <profile>
      <providers>
        <clear/>
        <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/"/>
      </providers>
    </profile>

    <roleManager enabled="false">
      <providers>
        <clear/>
        <add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/" />
        <add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/" />
      </providers>
    </roleManager>

  </system.web>

  <system.webServer>
     <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>
</configuration>

4. Create a new folder called Yaf in your web application.

5. Download the latest stable version of Yaf from the Yaf website and copy the contents into the Yaf folder you have just created.

At this point we have the basics in place to proceed the integration. If people can clearly mark out the best practice to move onto the next stage from here we can hopefully provide a great resource for future use. Like I say I have not come across a full step by step guide that works so if we can do this it will be beneficial foe everyone.

Please continue with the next stages and thanks for any contributions.

Sponsor
ajay_ndelhi
13 years ago
Looking for more updateson this thread.
cheekykevwalker
13 years ago
Are there no YAF experts on here who can help out with this?
kjkramer
  • kjkramer
  • 51.2% (Neutral)
  • YAF Forumling
13 years ago
Seriously cheekykevwalker, I'm with you. There is no straight forward, step-by-step easy to use guide on how to do this anywhere. This is something that absolutely needs to be discussed and posted somewhere obvious (for us that are less familiar with membership manipulation/integration, etc...), because I'm sure many people are having the same issue that you and I are. Anyone have a good solution?
jaekim930
12 years ago
cheeky,

You speak for many ... I am trying to intregrate my forum into my site ... but having a devilish time on membership ... the documentation is so slim ... granted that it's an open source project but you'd think that an issue like membership integration would be desired by most implementers ... oh man, I don't know ... I initially used SMF but then discovered that ASP membership integration is not easily done so I switched to YAF due to its "strong" asp.net support ... but I have to say, the few days that I tinkered with Simple Machines Forum was cake compared to this ...

So, I'm stuck trying to implement membership, which was a primary reason for me to use YAF ... i'm making adjustments in web.config but it's just not clicking ... going trial and error is time consuming and frustrating for a relative newbie like myself ... ;-(

YAF experts, can you hear us?

jk

kjkramer
  • kjkramer
  • 51.2% (Neutral)
  • YAF Forumling
12 years ago

cheeky,

You speak for many ... I am trying to intregrate my forum into my site ... but having a devilish time on membership ... the documentation is so slim ... granted that it's an open source project but you'd think that an issue like membership integration would be desired by most implementers ... oh man, I don't know ... I initially used SMF but then discovered that ASP membership integration is not easily done so I switched to YAF due to its "strong" asp.net support ... but I have to say, the few days that I tinkered with Simple Machines Forum was cake compared to this ...

So, I'm stuck trying to implement membership, which was a primary reason for me to use YAF ... i'm making adjustments in web.config but it's just not clicking ... going trial and error is time consuming and frustrating for a relative newbie like myself ... ;-(

YAF experts, can you hear us?

jk

Originally Posted by: jaekim930 

I actually found this after doing some research on this topic. Got me in the right direction. Took a little manipulation based on how my server was personally set up, but it helps. Still does not change the fact that it should be easier to do or better explained. Obviously the YAF website is doing exactly what we are trying to figure out how to do.

http://ewitch.net/docs/YAFMembershipIntegration.pdf  -- This document was created by ewitcher (http://forum.yetanotherforum.net/yaf_profile12044.aspx). Thank you!

jaekim930
12 years ago
spent 2 frustrating days trying unsuccessfully to integrate asp.net membership between my site and YAF ... this sucks ... i understand that this is open source, it's free, etc. ... but you'd think that after 9 years of development, they'd know that many ppl have problems with this part and would provide some better documentation/guide ...

integrating the membership was the ONLY reason that i tried YAF ... i originally looked at Simple Machine Forum and it was excellent ... easy to set up and navigate, tons of templates to choose from ... but it's not easy to integrate asp.net membership there (php based, etc.) ... so eventually, i found YAF and decided to try it ...

at this point, i'm so frustrated that i've decided to build my own message board ... i expect it to take 3-4 days ... but i can manage a decent one without all the bells and whistles ... but at least it'll be integrated and I know how to customize anything regarding it ...

am pretty disappointed at the lack of support on this issue here ... I rate YAF 3 out of 5 stars on just the forum itself ... and a 1 out of 5 on memberships integration ...

ebirbal
  • ebirbal
  • 51.8% (Neutral)
  • YAF Forumling
nabramovitz
12 years ago
YAF version 1.9.6

I am trying the approach of replacing the stored procedures that the YAF membership related providers are using. In this way, I am hoping I can mix the YAF provider tables and our product tables together (ie, I can use the YAF tables to handle values our product tables does not have if some constant value would not work.)

eiles
  • eiles
  • 50.2% (Neutral)
  • YAF Forumling
12 years ago
I created an account just for this. I did this long time ago. I don't have the project with me anymore, but it was easy. Maybe that's why people don't response to you guys.

Build the YAF.Providers project and copy all required dlls to your own project.

Add this in web.config of your own website.

or

You can write your own custom membership provider. something like that

Add this in web.config.

on C# code, you need to have a class that inherit MembershipProvider. Then override all the MembershipProvider methods.

like

public class CustomMembershipProvider : MembershipProvider

{

public override MembershipUser CreateUser(....)

{

custom code here...

or call the create user method from

}

public override MembershipUser GetUser(string username, bool userIsOnline)

{

code ....

}

...

}

do the same thing for roleProvider