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.0Bit stuck - integrating a loginBit stuck - integrating a login
Previous
 
Next
New Post
3/22/2009 6:50 PM
 

I am a bit stuck working out where to go next with some development work. I am hoping to find some guidance here.

I have a DNN 4 site and a Classic ASP membership management system (MMS), both running under the same domain. Users will log into the MMS, and I would like them to be automatically logged into DNN at the same time.

So far, I have the creation of DNN users working. When users log into the MMS, a web service sends the user details to DNN, and that service then creates or updates that user, resets their password, puts them into the relevant roles etc. The tricky part is logging them in.

My current idea, is for the web service to create a temporary password for that user (single-use, with a limited lifetime of perhaps a minute). The password would be stored in the DNN database, and also returned to the ASP MMS through the web service. That password would then get passed back to the user's browser as a cookie. The next time that user visits the DNN site (which should be almost immidately after logging in) I would like something in that site to recognise the cookie, look the value up in the database, if it matches log the user in immediately, and then continue. The cookie and password is then destroyed, since it is on no further use.

Now, that all seems like a straightforward solution to me, and one that I would guess would involve a couple of dozen lines of code at most. However, I cannot work out exactly where that code needs to go. I just don't know where to start.

I am not familiar with ASP.net, and I don't have a working VS environment (I just couldn't get it to work with DNN), so I am coming at this with not much more than a text editor.

Any help glady received. Remember the ultimate solution I am looking for, is that when a user logs into an independant ASP application that happens to be on the same domain, they should be automatically created and logged into the DNN application. I have the 'created' part working.

-- Jason

 
New Post
3/22/2009 8:35 PM
 

Of course, I am trying to find somewhere in the tangled web of classes that makes up the core of DNN to put this code, but forgot completely that all requests go through Default.aspx. That (or a copy of that file) would be an ideal place to put the auto-login code.

-- Jason

 

 
New Post
3/22/2009 9:33 PM
 

Since I cannot edit posts, I'll just reply to myself ;-) This is what I have come up with, after some research, which I hope will be useful to others.

The following script, if placed in the root folder (e.g. Auth.aspx) will log any user in without knowing their password, and then send them to any given page. As part of a single-signon system, this would be the final stage. It just remains for me to pass these user credentials to this entry-point (direct from application to application, giving the browser a temporary ticket of some kind - a GET parameter or a cookie) and the single-signon should be complete.

Thanks for the help, which I eventually found through this forum and links to other forums.

-- Jason

 

--- Auth.aspx ---

<%@ Page %>
<%@ Import Namespace="System.Web.Security" %>
<%@ Import Namespace="DotNetNuke" %>
<script runat="server" language="vb">
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)

' Derive all these values from the cookie (preferably values left in a table
' by the original web service that created the user, so they do not need to
' go via the user browser.

' The portal we want to log into.
Dim intPortalID As Integer = 0
' The username we want to log in as.
Dim strUserName As String = "my_user_name"
' The page we want to go to after logging in.
Dim intTabId As Integer = 73

Dim objUser As UserInfo
Dim objUserController As New UserController
objUser = objUserController.GetUserByName(intPortalID, strUserName)
' Is the IP address (parameter 4) required?
objUserController.UserLogin(intPortalID, objUser, "DNN", "", True)
' Not sure if the cookie needs to be set like this?
'formsAuthentication.SetAuthCookie(ObjUser.userId.ToString(), False)
Response.Redirect("Default.aspx?TabId=" & intTabId.ToString())

End Sub
</script>


 

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Bit stuck - integrating a loginBit stuck - integrating a login


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