Auto Login for users on Intranet

Post here for help with installing or upgrading mojoPortal pre-compiled release packages. When posting in this forum, please provide all relevant details. You may also want to review the installation or upgrading documentation.

If you have questions about using the source code or working with mojoPortal in Visual Studio, please post in the Developer forum.

Post here for help with installation of mojoPortal pre-compiled release packages

When posting in this forum, please try to provide as many relevant details as possible. Particularly the following:

  • What operating system were you running when the bug appeared?
  • What database platform is your site using?
  • What version of mojoPortal are you running?
  • What version of .NET do you use?
  • What steps are necessary to reproduce the issue? Compare expected results vs actual results.

You may also want to review the installation or upgrading documentation.

If you have questions about using the source code or working with mojoPortal in Visual Studio, please post in the Developer forum.

This thread is closed to new posts. You must sign in to post in the forums.
3/20/2009 1:51:07 PM
Gravatar
Total Posts 5

Auto Login for users on Intranet

I want to configure Mojoportal to allow users to automatically login and create an "Authenticated Users" Role for their account, the first time they visit the site on our intranet.

I am using  2.2.8.2 MSSQL IIS6 Server2003.

I first tried to configure Mojoportal using "Windows Authentication"  (http://www.mojoportal.com/usingwindowsauthentication.aspx)

With this configuration a user would be allowed on the site, but a new user account would not be created in the Mojoportal database.  Also, when you clicked on "My Account" and the "Security/Identity" tab, the "User ID" field is blank.  Any information provided in this tab would not be saved to an account.

If the user already had an account in the Mojoportal database then the user would be logged on with that account.

I have read on another post (http://www.mojoportal.com/Forums/Thread.aspx?pageid=5&mid=34&ItemID=9&thread=326&postid=1306) that a new account should be created in the Mojoportal database if it doesn't exist.  This is the behavior I am looking for, but it is not working

Next I tried the LDAP method described in this post http://www.mojoportal.com/usingactivedirectory.aspx.  This method creates a new account in the Mojoportal database, but the drawback to this method is the account is not created until the user logs in and provides their windows user name and password.  I want this process to be automatic without a user having to login.

Is this how Mojoportal was designed, or do I have a configuration problem.  Any help or suggestions would be very helpful.

Thanks,

Ken Maxfield

 

3/21/2009 7:49:48 AM
Gravatar
Total Posts 18439

Re: Auto Login for users on Intranet

Hi Ken,

Try putting "NTLM" instead of "Windows" and see if that makes a difference.

Hope it helps,

Joe 

3/27/2009 11:13:06 AM
Gravatar
Total Posts 5

Re: Auto Login for users on Intranet

I am assuming you are referring to placing "NTLM" into the web.config file instead of "Windows" in the line <authentication mode="Windows" />. I tried this and it didn't work. 

Can you confirm that the normal behavior of Mojoportal is to create a new user in the Mojoportal database when using Windows authentication for a new user on an intranet?

I know that Mojoportal will create a new user in the Mojoportal database when using the LDAP method, because I have been successful in trying this method.

I am also running another software package on the same website called Jitbit AspNetForum.  It too uses Windows authentication, and the settings in the web.config file allow AspNetForum to work properly for Windows authentication. 

Ken

3/27/2009 11:19:41 AM
Gravatar
Total Posts 18439

Re: Auto Login for users on Intranet

When I first answered your question it was because I saw we have logic to create a user 
if (Context.User.Identity.AuthenticationType == "NTLM" )

at that time I changed it to this:
if (( Context.User.Identity.AuthenticationType == "NTLM" )|| ( Context.User.Identity.AuthenticationType == "Windows" ))

So if you have the newest version of mojoPortal I think it "should" automatically create a mojo user for windows users in the application_AuthenticateRequest event in global.asax.cs

Hope it helps,

Joe
 

 

4/7/2009 5:33:00 PM
Gravatar
Total Posts 5

Re: Auto Login for users on Intranet

I have installed the latest version (2.2.9.6).  It is still not creating a new user using "Windows Authentication".  Can someone confirm that mojoPortal will create a new user in the database when using "Windows Authentication" on an intranet.  I need to know if this is a configuration issue with IIs or mojoPortal code issue.

Thanks,

Ken 

4/8/2009 9:06:01 AM
Gravatar
Total Posts 18439

Re: Auto Login for users on Intranet

Hi,

I just tested it here using IIS 7 on Vista and it does automatically create the user when I use Windows authentication.

The welcome message shows me Signed in as: vista1\Joe Audette and when I visit the My Account page I see it did create the user as I have a profile with user name vista1\Joe Audette

Hope it helps,

Joe

4/13/2009 11:57:24 AM
Gravatar
Total Posts 5

Re: Auto Login for users on Intranet

Joe,

I think I solved this issue.  I am using IIS 6.0 for my website.  Integrated Windows Authentication includes "Negotiate", "Kerberos", and "NTLM" authentication methods.  When the following code is called---Context.User.Identity.AuthenticationType == "NTLM" from the Global.asax.cs IIS it is returning "Negotiate" and not "Windows" as a value.  This is causing a bunch of code to be skipped.  I verified that my Context.User.Identity.AuthenticationType value was "Negotiate" by inserting some log.Debug statements in the code, compling the code and then copying it up to my working site.  When I tried to debug this within VS the value was "NTLM", so I had to get creative in trying it on my working site.

It can be fixed by changing this line of code from--

if (( Context.User.Identity.AuthenticationType == "NTLM" )|| ( Context.User.Identity.AuthenticationType == "Windows" ))

to

if (( Context.User.Identity.AuthenticationType == "NTLM" )|| ( Context.User.Identity.AuthenticationType == "Negotiate" ))

Here is some information on the issue

www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/523ae943-5e6a-4200-9103-9808baa00157.mspx

I will let you make any code changes if you think this is the solution.

 

Ken

4/13/2009 12:33:39 PM
Gravatar
Total Posts 18439

Re: Auto Login for users on Intranet

Hi Ken,

I agree with your diagnosis and solution. I will make the same change here. 

Thanks,

Joe

You must sign in to post in the forums. This thread is closed to new posts.