HomeHomeUsing DotNetNuk...Using DotNetNuk...Administration ...Administration ...Preserve Login ParametersPreserve Login Parameters
Previous
 
Next
New Post
7/11/2006 1:27 PM
 

Preserve Login Parameters - when a user is directed to the login screen, the system needs to retain the original url ( with parameters ) so that it can redirect back after successful login ( especially useful in nested module UIs like Forum )

This does not appear to be working.  When I follow a link which leads to a details page of a module, I am redirected just to the page the module is on the first time the credetial cookie is set.  If I follow the link after that, I go where I expect to go.

Authentication: Network
DNN Version:  4.3.1 Release Candidate (upgrade from 3.2.2)

 
New Post
9/28/2006 8:20 PM
 

I can't find any information about this feature anywhere, there are 3 posts about this already, wiith no real answers yet.

Does it work?

Where is it?

How can I turn it off and on.

 
New Post
9/29/2006 11:30 AM
 

Not having seen this working in 4.3.5, I implemented a fix myself.  I am using ADSI authentication - I have not mapped out the path for forms based authentication.  Code change in 2 locations:

Record the incoming URL:

HttpModule.Authentication
AuthenticationModule.vb
OnAuthenticateRequest

        Public Sub OnAuthenticateRequest(ByVal s As Object, ByVal e As EventArgs)
            Dim _portalSettings As PortalSettings = Common.GetPortalSettings
            Dim config As Authentication.Configuration = Authentication.Configuration.GetConfig()

            If config.WindowsAuthentication Then
                Dim Request As HttpRequest = HttpContext.Current.Request
                Dim Response As HttpResponse = HttpContext.Current.Response
                Dim authStatus As AuthenticationStatus = AuthenticationController.GetStatus(_portalSettings.PortalId)

                Dim blnWinLogon As Boolean = (Request.RawUrl.ToLower.IndexOf((AUTHENTICATION_LOGON_PAGE).ToLower) > -1)
                Dim blnWinLogoff As Boolean = (authStatus = AuthenticationStatus.WinLogon) AndAlso (Request.RawUrl.ToLower.IndexOf((AUTHENTICATION_LOGOFF_PAGE).ToLower) > -1)

                If (authStatus = AuthenticationStatus.Undefined) Then  'OrElse (blnWinLogon) Then
                    AuthenticationController.SetStatus(_portalSettings.PortalId, AuthenticationStatus.WinProcess)
                    Dim url As String
                    If Request.ApplicationPath = "/" Then
                        url = "/Admin/Security/WindowsSignin.aspx?tabid=" & _portalSettings.ActiveTab.TabID.ToString
                    Else
                        url = Request.ApplicationPath & "/Admin/Security/WindowsSignin.aspx?tabid=" & _portalSettings.ActiveTab.TabID.ToString
                    End If
                    Try
                        Dim refUrl As String = Request.RawUrl
                        Response.Clear()
                        Response.Cookies("DNNReturnTo" & _portalSettings.PortalId.ToString()).Value = refUrl
                        Response.Cookies("DNNReturnTo" & _portalSettings.PortalId.ToString()).Path = "/"
                        Response.Cookies("DNNReturnTo" & _portalSettings.PortalId.ToString()).Expires = DateTime.Now.AddMinutes(2)
                    Catch
                    End Try
                    Response.Redirect(url)
                ElseIf (Not authStatus = AuthenticationStatus.WinLogoff) AndAlso blnWinLogoff Then
                    Dim objAuthentication As New AuthenticationController
                    objAuthentication.AuthenticationLogoff()
                ElseIf (authStatus = AuthenticationStatus.WinLogoff) AndAlso blnWinLogon Then ' has been logoff before
                    AuthenticationController.SetStatus(_portalSettings.PortalId, AuthenticationStatus.Undefined)
                    Response.Redirect(Request.RawUrl)
                End If

            End If

        End Sub

Redirect to captured URL:

DotNetNuke.Library
Components
Authentication
AuthenticationController.vb
AuthenticationLogon

        Public Sub AuthenticationLogon()
            Dim _config As Authentication.Configuration = Authentication.Configuration.GetConfig()
            .......
            .......
            ' does nothing, just to force page to be refreshed
            Dim querystringparams As String = "logon=" & DateTime.Now.Ticks.ToString()
            Dim strURL As String = NavigateURL(_portalSettings.ActiveTab.TabID, "", querystringparams)
            If Not HttpContext.Current.Request.Cookies("DNNReturnTo" + _portalSettings.PortalId.ToString()) Is Nothing Then
                querystringparams = HttpContext.Current.Request.Cookies("DNNReturnTo" + _portalSettings.PortalId.ToString()).Value
                If querystringparams <> "" Then strURL = querystringparams
            End If
            HttpContext.Current.Response.Redirect(strURL, True)

        End Sub

 
New Post
1/3/2007 4:35 PM
 

Updated for 4.4.0

Record the incoming URL:

HttpModule.Authentication
AuthenticationModule.vb

Public Sub OnAuthenticateRequest(ByVal s As Object, ByVal e As EventArgs)
.....
If (AuthenticationController.GetStatus(_portalSettings.PortalId) = AuthenticationStatus.Undefined) Then  'OrElse (blnWinLogon) Then
    AuthenticationController.SetStatus(_portalSettings.PortalId, AuthenticationStatus.WinProcess)
    Dim url As String
    If Request.ApplicationPath = "/" Then
        url = "/Admin/Security/WindowsSignin.aspx?tabid=" & _portalSettings.ActiveTab.TabID.ToString
    Else
        url = Request.ApplicationPath & "/Admin/Security/WindowsSignin.aspx?tabid=" & _portalSettings.ActiveTab.TabID.ToString
    End If
    Try
        Dim refUrl As String = Request.RawUrl
        Response.Clear()
        Response.Cookies("DNNReturnTo" & _portalSettings.PortalId.ToString()).Value = refUrl
        Response.Cookies("DNNReturnTo" & _portalSettings.PortalId.ToString()).Path = "/"
        Response.Cookies("DNNReturnTo" & _portalSettings.PortalId.ToString()).Expires = DateTime.Now.AddMinutes(2)
    Catch
    End Try
    Response.Redirect(url)
ElseIf ....
......
End Sub

Redirect to captured URL:

DotNetNuke.Library
Components
Authentication
AuthenticationController.vb

 Public Sub AuthenticationLogon()
.....

.....

' params "logon=windows" does nothing, just to force page to be refreshed
'Dim strURL As String = NavigateURL(_portalSettings.ActiveTab.TabID, "", "logon=windows")
'HttpContext.Current.Response.Redirect(strURL, True)
'Updated to redirect to querrystring passed in prior to authentication
Dim querystringparams As String = "logon=" & DateTime.Now.Ticks.ToString()
Dim strURL As String = NavigateURL(_portalSettings.ActiveTab.TabID, "", querystringparams)
If Not HttpContext.Current.Request.Cookies("DNNReturnTo" + _portalSettings.PortalId.ToString()) Is Nothing Then
    querystringparams = HttpContext.Current.Request.Cookies("DNNReturnTo" + _portalSettings.PortalId.ToString()).Value
    If querystringparams <> "" And querystringparams.IndexOf("WindowsSignin.aspx") < 0 Then strURL = querystringparams
End If
HttpContext.Current.Response.Redirect(strURL, True)
End Sub
 
New Post
4/30/2007 10:37 AM
 

Hi

Will this code work with DNN 3.3.7?

Cheers

 
Previous
 
Next
HomeHomeUsing DotNetNuk...Using DotNetNuk...Administration ...Administration ...Preserve Login ParametersPreserve Login Parameters


Forum Policy

These Discussion Forums are dedicated to the discussion of the DotNetNuke Web Application Framework.

For the benefit of the community and to protect the integrity of the project, 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 DotNetNuke.
2. Discussion or promotion of DotNetNuke product releases under a different brand name are strictly prohibited.
3. No Flaming or Trolling.
4. No Profanity, Racism, or Prejudice.
5. Site Moderators have the final word on approving/removing a thread or post or comment.
6. English language posting only, please.

Attend A Webinar
Start  Professional Edition Trial
Have Someone Contact Me

Like Us on Facebook Join our Network on LinkedIn Follow DNN Corporate on Twitter Follow DNN on Twitter

Advertisers

Sponsors

DotNetNuke Corporation

DotNetNuke (DNN) provides a suite of solutions that make designing, building and managing feature-rich sites and communities fast, easy and cost-effective. The DotNetNuke Platform CMS is the foundation for more than one million websites worldwide. DNN Social, our newest solution, enables businesses to create immersive, interactive communities. Thousands of organizations like True Value Hardware, Bose, Cornell University, Glacier Water, Dannon, Delphi, USAA, NASCAR, Northern Health and the City of Denver have leveraged DNN to deploy highly engaging business- critical websites. Our rapid growth in product sales and deployments resulted in DotNetNuke Corp. being named one of the fastest growing private companies in America by Inc. Magazine in 2011 and 2012.