Search code examples
c#asp.netdotnetnuke

Create authentification cookie to specific portal


im newbe here. I read post: How can I manually create a authentication cookie instead of the default method?

Is anyone know how to generate cookie to specific portal ? Lets say i have 2 portals on one instance of DotNetNuke. If i try to login on first portal i want generate cookie by example to second portal. (On second portal this user was added, on first portal he doesnt exist - so he cant login to first portal).


Solution

  • With DNN there are a few things that you have to do with this, and some business rules to keep in mind.

    Option 1: Portal 1 & Portal 2 Are Separate Domains

    This option will NOT work without major changes as a cookie is used and cookies are associated to a domain.

    Option 2: Portal 1 & Portal 2 Use Same Domain (Child Portals/Folders)

    This option would look like www.mysite.com and www.mysite.com/site2 for the default URLs. In this situation no changes to cookie processes are needed. BUT, you need to ensure that the UserPortals table has an entry for the same UserId in both portals.

    Option 3: Portal 1 & Portal 2 Use Same Root Domain But Subdomains used

    This option would look like www.mysite.com and Site2.mysite.com for the default URLs.

    You still need to modify the UserPortals table entries. But a secondary change is on the Forms authentication configuration in the web.config set the domain to be mysite.com and then it will work!