custom single sign-on with my site using MSSQL membership

Apr 12, 2011 at 10:05 AM

Hi,

This forum is interesting and would like to try out custom single sign-on with my site with MSSQL membership.

This forum would be deployed in forum.domainname .  Currectly i am working on it but still struggling with this issue. Appreaciate if your have the example source for me as a guideline.

Thank you.

Coordinator
Apr 12, 2011 at 10:29 AM

Hi Kwek,

In your case you have 2 options for sign-in users using your existing db:

  1. Use a custom single sign-on with your site: To enable this, you should expose a OpenId Service Provider from your main site. If you are using .net in your main site, you can do it using Dotnetopenauth (its very little amount of work, there is working sample on the latest version of Dotnetopenauth).
    Once you create it, copy the url of the service provider to the element ssoOpenid in the configuration file Site.config
  2. Use MSSQL ASP.NET Membership: No extra development should be done, you will have to setup the right configuration in the web.config.

In order to use asp.net membership, you will have to get the latest version from the repository, because only facebook, twitter and custom single sign-on are the available providers on the latest release (V5.0). We will release the next version in a couple of weeks (containing the asp.net membership support) if you can wait.

In any case, if you need assistance, don't hesitate to ask,

Kind Regards,

Jorge

Apr 12, 2011 at 6:59 PM

Thanks Jorge for speedy reply. One more question regarding "Notify me of new posts on this thread via email".

I have set the mail setting at Web.config as below,

<system.net>

<mailSettings>

<smtp deliveryMethod="Network">        

<network         host="mail.XXXX.com"         port="25"         defaultCredentials="true"          userName ="admin@XXXX.com"          password ="XXXXXX"          enableSsl ="false"                  />      

</smtp>

</mailSettings>

</system.net>

But the application did not send any notification to anyone. Is there anything that i left in setting? Appreciate if you can enlighten this.

Thank you.

Best Regards

Kwek

Coordinator
Apr 13, 2011 at 9:44 AM

Hi Kwek,

I will try to guess the possible causes...

A) In order to notify the user posting should be different from the notified user (the system will not send a mail to the same user that posted the message).

B) The smtp is refusing to send on behalf the IIS user or the configuration for the smtp server is incorrect (did you notice you are missing the from attribute of the smtp element?).

To test you could set the delivery method to SpecifiedPickupDirectory and the emails will be save in your disk

<mailSettings>

<smtp deliveryMethod="SpecifiedPickupDirectory" from="admin@yoursite.com">

<specifiedPickupDirectory pickupDirectoryLocation="c:\Temp\" />

</smtp>

</mailSettings>

C) The destination mail server (the email server of the notified user) is blocking (as spam) the email sent. To test do the same as in (B).

 

Hope it helps,

If not, give me as much detail as you can of the enviroment (is your local machine or a shared server / is your smtp server on another machine / ...)

Apr 13, 2011 at 10:32 AM

I host it in shared server. My primary domain application manage to send email. But this forum application in subdomain still couldn't send email if someone replied the message. I just set the web.config as below in web hosting . And i using different userId and Email to reply each other. i even check out the spam inbox, but still not manage to make it works.

<system.net>

<mailSettings>

<smtp deliveryMethod="Network">        

<network         host="mail.XXXX.com"         port="25"         defaultCredentials="true"          userName ="admin@XXXX.com"          password ="XXXXXX"          enableSsl ="false"                  />      

</smtp>

</mailSettings>

</system.net>

Hope your can help me on this. How you set your notification works in web hosting. Just set web config oni?

 

 

 

Coordinator
Apr 13, 2011 at 10:59 AM

Hi,

On the sample forum website, the mailSettings configuration is simple because the smtp server is on the same machine, here is the configuration:

<mailSettings> <smtp deliveryMethod="network" from="admin@nearforums.com"> <network host="localhost" /> </smtp> </mailSettings>

 

I see 2 possible problems on your configuration you copied, see below:

<system.net>

<mailSettings>

<smtp deliveryMethod="Network" from="admin@XXXX.com">        

<network         host="mail.XXXX.com"         port="25"         defaultCredentials="false"          userName ="admin@XXXX.com"          password ="XXXXXX"          enableSsl ="false"                  />      

</smtp>

</mailSettings>

</system.net>

 

1) Specify the from attribute in the smtp element.

2) Set defaultCredentials=false. Default credentials means the current windows user (IIS user account).

 

Were your username and password of the smtp server provided by your server admin/ hosting provider?

Is logging enabled in your nearforums website (Config/Logging.config), can you access to it?

 

Kind Regards,

Jorge

Apr 13, 2011 at 11:15 AM

Great...I fixed it already. The reason is i using the primary domain email user as the forum application is in subdomain. To fix it..just create another email user for that subdomain would fix the stuff..;)

Thanks Jorge..

Coordinator
Apr 13, 2011 at 11:16 AM

Happy to hear that!

Apr 13, 2012 at 11:39 PM

Hi i got the same problem,

i have the forum running on a subdomain on a shared host under Plesk. I configured smtp the same as in my main domain, but i get no emails. The main domains smtp is working correctly though.

Any more ideas?

I have no idea how i could set a subdomain user/mail account under Plesk. There is no option for it.

Coordinator
Apr 14, 2012 at 4:01 PM

Hi Jannes,

The problem is that Nearforums sends the notifications asynchronously so you won't see the exception that is being thrown (we are aware and we are going to improve it).

In the meantime, to try to solve it, could you send me the mailSettings configuration from your main site (like kwek did)?

Regards,

Jorge

May 12, 2012 at 11:21 AM

Hello all,

I am new to the MSSQL ASP.NET Membership provider.  I have it set up so that when a user creates an account on my site they are also registered for the forums, however when they go to the forums it asks them to log in.  Is there a way to set it up so that they are logged in automatically?

thanks,

JMP

Coordinator
May 12, 2012 at 9:34 PM
Edited May 12, 2012 at 9:35 PM

Hi JMP,

To share form authentication ticket (cookie) between 2 ASP.NET applications you should use the same machineKey (configured at web.config level).

Here you have more information: http://msdn.microsoft.com/en-us/library/ff649308.aspx

 

If you have any doubts, don't hesitate to contact us here.

Kind Regards,

Jorge

May 12, 2012 at 11:54 PM
Edited May 13, 2012 at 12:07 PM

Hey Jorgebg,

 

Thank you for the response, setting the machineKey seems to have done the trick.  I did notice in my testing though that when I delete a user through the admin panel it does not seem to be deleting the DB record. It also lets me log in using the username that I deleted through the Admin panel.  Any ideas on how I can configure it to delete the users through the admin panel?

 

Edit: To clarify my question above, it looks like when I delete a user through the admin panel it sets the Active bit to False in the Users table, but does not seem to make any change to the aspnet_Users table.  When the deleted user tries to log into the forum the authentication logic correctly identifies that the user has been deleted but then it checks the aspnet_users table, finds the user data and creates a new active record in the Users table.

I am still familiarizing myself with the code so it is very likely I have over looked something. Please let me if there is a configuration setting I am missing or if I have set up something incorrectly.  For my purposes It looks like it will be simple enough to change the SPUsersDelete stored procedure to just delete the record from the aspnet_users table, but I just want to make sure I am not missing anything before I do it.

again thanks in advance for any help,

JMP