3

We are building a ASP.NET MVC 4 website that will display information specific to the DotNetNuke logged in user. In order to accomplish this we are setting up the machine keys in the web.config to be exactly the same, and we are also setting the <authentication> config section to match across the websites in order to see what DotNetNuke user is logged in from the MVC site.

There are many examples of how to accomplish this. This is a guide we used: http://msdn.microsoft.com/en-us/library/eb0zx8fc.aspx

However, this only works if we setup trust between two DotNetNuke sites or two non DotNetNuke sites. If the ASP.NET auth-cookie is set in in DotNetNuke, we don't have access to it in the MVC site. After logging into the DotNetNuke site, then browsing to the MVC site, the HttpContext.Current.User.Identity.Name is empty.

The two sites are setup on the same server, each running under a different port. Anonymous and Forms Authentication are both enabled in IIS 8 as this is running on Windows Server 2012.

Here are the web.config values that are set across both sites:

MachineKey Values: <machineKey decryption="3DES" decryptionKey="C7DE3391E9E25BC1106BA55B1A86EB825A66A06A2AA720CF" validation="SHA1" validationKey="F41C305583E22214850AD9B2B989588F5045EE2A99EFF68849B81EF154CFF745230F12D4BCFEBB0214BB24F8A6EDB34A9B45BB0849F6CB60E5D23528A69DBBC6" />

Authentication Section: <authentication mode="Forms"> <forms timeout="60" cookieless="UseCookies" ticketCompatibilityMode="Framework40" /> </authentication>

Any insight would be appreciated.

Thanks!

Artel
  • 93
  • 6
  • Ideally what you have done is enough, what is the problem implementing this? – Prashant Lakhlani Jan 02 '13 at 14:19
  • The problem is that we cannot see the logged in user from the MVC site (and we don't know why). Essentially, HttpContext.Current.User.Identity.Name on the MVC site is empty. – Artel Jan 02 '13 at 14:25
  • Can you use fiddler and see what exactly is happening at browser end? – Prashant Lakhlani Jan 02 '13 at 16:19
  • try setting the "name" attribute on your tag in the web.config; make sure it has the same value in both applications. – roman m Mar 05 '13 at 22:27
  • Were you ever able to solve this? I have a similar requirement. – Apeksha Apr 24 '14 at 21:31
  • You might find something here: http://stackoverflow.com/questions/28713628/asp-net-webforms-and-mvc-authentication-sharing-via-cookie/28736392#28736392) – Atters Feb 26 '15 at 07:26

0 Answers0