2
votes

I am working away at a Umbraco project, with the goal to be that the user is automatically logged into Umbraco based on their domain username. These are the steps I have so far:

  • I am hosting a test Umbraco site on IIS 7
  • The site settings have windows Authentication, meaning that you have to be logged into the domain to access the site
  • I have created a macro that identifies the current user as soon as someone accesses the page. If the user does not have a matching Umbraco Member Account, then one is automatically created, based on their domain user.

As it stands now, if someone on the domain accesses the Umbraco site, then they will have a Member with a matching username automatically created in Umbraco if it doesn't exist. This is done passively.

The last stage however is that I require that user to become the registered logged in Member. I know who the Umbraco Member is, I just need to have that member automatically logged into Umbraco.

Does anyone know how I can do this?

I'm coding in C#, but any form of documentation would be appreciated.

Many thanks.

1

1 Answers

3
votes

The Umbraco members section uses the asp.net membership system, so you can just call the FormsAuthentication.SetAuthCookie() method to set the logged in user details. I think you also need to tell Umbraco to cache the member. This post on our.umbraco.org has some details.