This project is read-only.

Integrate with MVC3

Nov 26, 2011 at 7:36 AM


I am using MVC3 and looking to integrate your forum engine with my site. What I need is to show it within my own site. I also need to integrate the membership, so users of my site can use the forum without having to sign in again a second time. How can I do this?


Nov 26, 2011 at 9:26 PM


You could setup Nearforums in a subapp inside an IIS folder or in a subdomain of your website.

About login you existing users:

  • If you are using ASP.NET Membership, you just need to configure it in the web.config and it will work.
  • If you are not using Membership, you can set up a OpenId Single sign on service provider on your main site and then configure Nearforums to use it.

Hope it helps,

Kind Regards,



Nov 29, 2011 at 1:05 PM
Edited Nov 29, 2011 at 1:08 PM

This is an excelent idea gordon, I would like to do the same.

Jorge, I need a little instruction on how to do this. I have a mvc 3 website hosted in my IIS server with MSSQL and I want to have nearforums inside a subapp. I know how to configure the ASP.NET Membership connection string, but where can I find instructions on how to configure a subapp? Post the instructions or a link to external source here so others will know.


BTW, I downloaded the source code but it will not compile on my VS2010, says it cannot find UI tests. I looked it up and UI Testing is only available with Visual Studio Ultimate or Premium. And I don't have those. Is it possible for me to disable the test unit?

Nov 29, 2011 at 1:58 PM

Hi Mario,

There is some documentation out there on how to create a SubApp on IIS. Like this one:

For running the Unit tests you need Visual Studio 2010 Professional or superior. 


Kind Regards,


Nov 29, 2011 at 7:06 PM
Edited Nov 29, 2011 at 7:07 PM

Thanks Jorge.

Ok I got the Forums under a subfolder and configured the authentication connection string to use my users database. But I am having trouble with creating the forums database. I tried executing the mssql.nearforums-db, it isn't working for me. Perhaps I need instructions on how to execute the mssql.nearforums-db script. This is what I done:

On my MSSQL Server I double clicked on the script, it brought up the Microsoft SQL Server Management Studio. I created a new database called Forums and made SQLUser as the owner. In the Server Role I checked public. Then I executed the script and got many error messages like this:

    Cannot grant, deny, or revoke permissions to sa, dbo, entity owner, information_schema, sys, or yourself.

And in the Forums Tables, nothing was created. How Does the script know to create tables in the Forums database, I see no references to Forums? And what permission do I need to give SQLUser?


Nov 30, 2011 at 9:21 AM

Hi Mario,

You must grant the user the database role "db_owner" and "public" for that database, besides mapping . (user mappings tab of Login Properties in SQL Management Studio) to execute the db script to create the required objects.


Kind Regards,


Nov 30, 2011 at 6:29 PM
Edited Nov 30, 2011 at 6:34 PM

Ah, I figured out what was wrong. Yes both db_owner and public is checked. The problem was the script was not executing on the Forum database. What I did this time was to right click the Forums database, select New Query, then copy and paste the entire script in the new query. Then execute the script and it created the tables.

Now the NearForums page come up, I see it working. But just one more thing, it is still using the Forums own membership tables and not my users login database, this is the connection string I added:

       <add name="Forums"
                connectionString="Data Source=MYSERVER; 
                Initial Catalog=Forums; User ID=SQLUser; Password=******" 
                providerName="System.Data.SqlClient" />

       <add name="MembershipUsers"
                connectionString="data source=MYSERVER; User ID=SQLUser; Password=******;
                Initial Catalog=Login;" />

               ... rest deleted ...

Is the name="MembershipUsers" correct? I believe I'm using the nearforums 7.0 executables, not the source code that I downloaded from the source code page.

Thank you kindly,

Dec 1, 2011 at 10:14 AM

Hi Mario,

You can choose the name of the 2nd connection string, but you have to set in membership provider configuration the connection string to be used.

Which connection string must membership use is set on the "membership" element in the configuration:

<membership defaultProvider="ForumsMembershipProvider">



<add name="ForumsMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="MembershipUsers" ...


Kind Regards,


Dec 1, 2011 at 4:06 PM
Edited Aug 11, 2013 at 2:07 PM
Hi Jorge, There was one more change required. Since nearforums resides in a sub app, it required me to change applicationName as well:            <add name="ForumsMembershipProvider" ... stuff deleted ...                               connectionStringName="MembershipUsers"                               applicationName="/" /> Thank you so much. So now it works! Nearforums is a sub app in a website that uses an existing user database. There is aside effect though, by intergrating the two sites this way, the site required me to login to the main site, login to nearforums to post, and login a third time back into the main site, because logging into nearforums kicked me back out of the main site. I'll will try to figure out if I can fix that. I'll also have to fix some stuff because they're not working. Here is a thread which discuss this: (Re: Single Sign on should work?) Single Sign On is not working for me. I will continue the discussion there. This is it if you want to see it -, click on the Forum tab. Best,Mario

This link is obsolete (, updated August 11, 2013