Dnn.platform: URL trimmed after no profile page is selected

Created on 11 Dec 2019  路  1Comment  路  Source: dnnsoftware/Dnn.Platform

URL trimmed after no profile page is selected

Deselecting the profile page in in site settings, or deleting the profile page (activity feed) page cause different URL redirect/rewrite behaviour.

When a profile page is selected, it is possible to navigate to:
/my-page/something-this-is-not-a-subpage

When no profile page is selected
/my-page/something-this-is-not-a-subpage redirects (301) to
/my-page

or

/my-page/qsdf
/my-page

This was described here: https://dnntracker.atlassian.net/browse/DNN-5864?page=com.atlassian.jira.plugin.system.issuetabpanels%3Aall-tabpanel

But was set to "could not reproduce". However the OP did find the cause, see thread.

However I could perfectly reproduce this on DNN 9.4 AND 8.4

Steps to reproduce

List the precise steps to reproduce the bug:

  1. Go to site settings and set "user profile page" to
  2. Go to any subpage and add a random text after the page, eg: /Contact/qsdf

Current behavior

/Contact/qsdf redirects to /Contact

Expected behavior

/Contact/qsdf stays like it is

Additional context

When setting a Profile page again (this can be any dummy page, even with no-view rights), the undesired redirect doesn't happen.

Regardless of what should happen (preferably nothing), This profile setting should not affect all other URLs.

Affected version

  • [X] 9.4
  • [X] 8.4.2
Platform > Library Low Medium Ready for Development Bug help wanted

Most helpful comment

The important part about that linked ticket is this:

I would like to leave a comment because I found the same issue yesterday.

It worked well before but suddenly not from yesterday.I thought I didn't change anything that could cause this issue, but in fact I was wrong.

After I debug the code I find the reason.
I changed Admin -> Site-Settings -> Advanced Settings - > User Profile Page to 'None Specified', and it caused this issue.

The code block related is: DotNetNuke.dll -> TabIndexController.cs

if (thisPortal != null && (thisPortal.UserTabId == tab.TabID || thisPortal.UserTabId == tab.ParentId || thisPortal.UserTabId == -1))
{
    //user profile action specified.  If tabid match for this tab, add a do301 check because we want to make
    //sure that the trimmed Url is used when appropriate
    rewritePath = RedirectTokens.AddRedirectReasonToRewritePath(rewritePath,
                                                                                ActionType.CheckFor301,
                                                                                RedirectReason.User_Profile_Url);
}
Because thisPortal.UserTabId is -1, so trimmed Url is used for every page.
It works again after I change to specific the User Profile Page.

Hope this comment can help you.

So I guess the correction here would be to check if the thisPortal.UserTabId == -1 and react accordingly.

>All comments

The important part about that linked ticket is this:

I would like to leave a comment because I found the same issue yesterday.

It worked well before but suddenly not from yesterday.I thought I didn't change anything that could cause this issue, but in fact I was wrong.

After I debug the code I find the reason.
I changed Admin -> Site-Settings -> Advanced Settings - > User Profile Page to 'None Specified', and it caused this issue.

The code block related is: DotNetNuke.dll -> TabIndexController.cs

if (thisPortal != null && (thisPortal.UserTabId == tab.TabID || thisPortal.UserTabId == tab.ParentId || thisPortal.UserTabId == -1))
{
    //user profile action specified.  If tabid match for this tab, add a do301 check because we want to make
    //sure that the trimmed Url is used when appropriate
    rewritePath = RedirectTokens.AddRedirectReasonToRewritePath(rewritePath,
                                                                                ActionType.CheckFor301,
                                                                                RedirectReason.User_Profile_Url);
}
Because thisPortal.UserTabId is -1, so trimmed Url is used for every page.
It works again after I change to specific the User Profile Page.

Hope this comment can help you.

So I guess the correction here would be to check if the thisPortal.UserTabId == -1 and react accordingly.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hismightiness picture hismightiness  路  5Comments

Roylej picture Roylej  路  3Comments

moorecreative picture moorecreative  路  4Comments

DanielNelsonCantarus picture DanielNelsonCantarus  路  5Comments

mnouraei picture mnouraei  路  5Comments