Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Using DNN To Authenticate Separate AppUsing DNN To Authenticate Separate App
Previous
 
Next
New Post
12/11/2006 12:21 PM
 
I have in the past been able to successfully log into a 2.0 ASP.NET site (not DNN) and been able to resuse the same auth cookie in a separate 1.1 ASP.NET site.  This is fairly straightforward.

I want to use DNN  (4.3.7) for authenticating users of a separate application (1.1) and am having trouble.  I have configured everything the same and set up a portal role in DNN with the same naming as the allowed role in my 1.1 site.

After logging into the 2.0 DNN, the Application_AuthenticateRequest method of my 1.1 site is able to grab the auth cookie and knows the user is forrms authenticated and properly extracts the id.  The problem is that the userData (i.e. roles) is empty.  The user keeps getting bounced to the DNN login.

Can anyone point me in the right direction?  Thank you.

            if (HttpContext.Current.User != null)
            {
                if (HttpContext.Current.User.Identity.IsAuthenticated)
                {
                    if (HttpContext.Current.User.Identity is FormsIdentity)
                    {
                        FormsIdentity id = (FormsIdentity)HttpContext.Current.User.Identity;
                        FormsAuthenticationTicket ticket = id.Ticket;
           
                        // Get the stored user-data, in this case, our roles
                        string userData = ticket.UserData;
                        string[] roles = userData.Split('|');    // this string array is empty
                        HttpContext.Current.User = new GenericPrincipal(id, roles);
                    }
                }
            }
 
New Post
12/12/2006 12:56 PM
 
I have figured it out.  DNN uses a separate cookie (portalroles) that contains the role information.  Why it does this I am not clear.  If anyone can answer why they chose to do things in this non-standard manner I'd be interested in knowing.

I do have a slight timing issue to resolve with the cookies still though.  After setting the portalroles cookie the user will be redirected from DNN to my 1.1 application.  In my 1.1 AuthenticateRequest method when I first request the portalroles cookie it is not on the client yet.  If anyone can tell me the best way to ensure this cookie makes it to the client in time for AuthenticateRequest I'd appreciate it.  Flushing the Response Buffer in DNN does not seem to help.  I'd rather avoid touching core code anyway.  Otherwise I'll have to resort to more crude solutions like redirecting to an intermediary page or something.

Lastly, if anyone wants the code, please post here.  If there is enough interest I'll write some step by step instructions.
 
New Post
12/12/2006 6:34 PM
 

Hey Shawn I am really interested in the code.  It sounds like exactly what I'm trying to do.

 

Thanks mate.

 

Joe Fallon.

 
New Post
12/13/2006 2:41 PM
 
I have it working nicely now.  Unfortunately I had to modify core code.  In my testing with 4.3.7 it works fine so far.

My 2 use cases:
  1. If not currently authenticated, if you request a page in the 1.1 application you will be be directed to the DNN login (providing the 1.1 app is properly configured).  After a successful login you are directed back to the requested page in the 1.1 app.
  2. After logging into DNN, clicking a link within DNN for a page within the 1.1 app takes you directly to the requested page.
I still need to do more testing to ensure I am not breaking anything in the core.  Folks interested in helping me test when its ready can email me:  shawn at bluetango dot ca . 
 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Using DNN To Authenticate Separate AppUsing DNN To Authenticate Separate App


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out