How to authenticate users from an existing db into Nearforums site
There are 3 methods to authenticate users from an existing repository or database into a Nearforums site.
If your website uses ASP.NET Membership
, you can configure the same membership provider in the web.config file of the Nearforums site.
This method will avoid the need for explicit user log on actions (logging on mainsite will also log into Nearforums site). Remember to use the same machine key
if you are using 2 different IIS websites.
Custom database authentication
If the database of your main site is accessible through a network connection, from the Nearforums site you can set up a custom db authentication provider.
To do so, create a procedure in your main db following this instructions
Once you created it, add a new connection string
pointing to your db (do not remove the connection string named "Forums"), in the web.config
file located in the root folder of your Nearforums site. For example: <add name="MainDb" connectionString="Data Source=YourDbServer;Initial Catalog=MainDb;User ID=sa;Password=12345678" providerName="System.Data.SqlClient"/>
Then, edit the element custom
on the Site.config
file located in the folder Config. For example:<customDbconnectionStringName="MainDb" storedProcedure="SP
NearforumsAuthenticateUser" registerUrl="http://yourmainsite.com/register/" forgotPasswordUrl="http://yourmainsite.com/forgot-password/" allowChangeEmail="false" accountEditUrl="http://yourmainsite.com/account/"/>
This feature is useful for websites that already have a user repository, host a main site in another domain or subdomain (ex: www.mainsite.com and forum.mainsite.com) and you can't expose the repository to Nearforums by other methods.
It requires extra development work in your main site.
To enable this functionality, you must expose a OpenId Service Provider from your main site. If you are using .net in your main site, you can do it easily using Dotnetopenauth.
Once you create it, copy the url of the service provider to the element ssoOpenid in the configuration file Site.config, located in the folder <... site root...>/Config/Site.config.