I was able to reproduce the PNG issue, as well the issue where http:/exampledomain.com was getting the 500 error, without runAllManagedModulesForAllRequests in the web.config. The issue is indeed in DotNetNuke.HttpModules. PNG files as well as TXT files were failing with 404 errors.
Starting at line 324 in UrlRewriteModule.vb:
If Request.Url.LocalPath.EndsWith("scriptresource.axd", StringComparison.InvariantCultureIgnoreCase) _
OrElse Request.Url.LocalPath.EndsWith("webresource.axd", StringComparison.InvariantCultureIgnoreCase) _
OrElse Request.Url.LocalPath.EndsWith("gif", StringComparison.InvariantCultureIgnoreCase) _
OrElse Request.Url.LocalPath.EndsWith("jpg", StringComparison.InvariantCultureIgnoreCase) _
OrElse Request.Url.LocalPath.EndsWith("css", StringComparison.InvariantCultureIgnoreCase) _
OrElse Request.Url.LocalPath.EndsWith("js", StringComparison.InvariantCultureIgnoreCase) _
OrElse Request.Url.LocalPath.EndsWith("png", StringComparison.InvariantCultureIgnoreCase) _
OrElse Request.Url.LocalPath.EndsWith("txt", StringComparison.InvariantCultureIgnoreCase) Then
Exit Sub
End If
Items in red above were added
Also in RequestFilterModule.vb line 59:
If request.Url.LocalPath.ToLower.EndsWith("scriptresource.axd") _
OrElse request.Url.LocalPath.ToLower.EndsWith("webresource.axd") _
OrElse request.Url.LocalPath.ToLower.EndsWith("gif") _
OrElse request.Url.LocalPath.ToLower.EndsWith("jpg") _
OrElse request.Url.LocalPath.ToLower.EndsWith("css") _
OrElse request.Url.LocalPath.ToLower.EndsWith("txt") _
OrElse request.Url.LocalPath.ToLower.EndsWith("js") _
OrElse request.Url.LocalPath.ToLower.EndsWith("png") _
OrElse request.Url.LocalPath.ToLower.EndsWith("txt") Then
Exit Sub
End If
The above seemed to resolve the PNG and TXT issue.
I found another issue with the following line in UrlRewriteModule.vb on line 408:
' parse the Request URL into a Domain Name token
DomainName = GetDomainName(Request, True)
GetDomainName actual returns "exampledomain.com/", instead of "exampledomain.com". The domain name has trailing "/". This needs to be parsed out. If not, when used on GetPortalAliasByPortal or GetPortalAliasInfo a few lines down it fails.
So for line 408 I added:
' parse the Request URL into a Domain Name token
DomainName = GetDomainName(Request, True)
'The domain name has trailing "/". This needs to be parsed out.
If Right(DomainName, 1) = "/" Then
DomainName = Left(DomainName, Len(DomainName) - 1)
End If
The better answer would probably be to take a look at GetDomainName, but I did not know/look where else it was being used that might needed it.
Last but not least, around line 487 you see this:
If PortalId <> -1 Then
' load the PortalSettings into current context
Dim _portalSettings As PortalSettings = New PortalSettings(TabId, objPortalAliasInfo)
app.Context.Items.Add("PortalSettings", _portalSettings)
The problem here is that TabId is -1 when the user tries to go to exampledomain.com/ or exampledomain.com/default.aspx. I was a little stumped at the best thing to do, so I had to get the portalsettings by PortalId via this:
If PortalId <> -1 Then
' load the PortalSettings into current context
Dim _portalSettings As PortalSettings
If TabId = -1 Then
'We have gotten this far, but there is a chance we do not have TabId
'Tried this and it does not work.
'_portalSettings = PortalController.GetCurrentPortalSettings()
'will have to get portalsettings by Portalid
'new settings object
Dim ps As New PortalSettings()
'controller instances
Dim pc As New PortalController()
Dim tc As New TabController()
Dim pac As New PortalAliasController()
'get the first portal alias found to be used as the current portal alias
Dim oPortalAliasInfo As PortalAliasInfo = Nothing
Dim aliases As PortalAliasCollection = pac.GetPortalAliasByPortalID(PortalId)
Dim aliasKey As String = ""
If aliases IsNot Nothing AndAlso aliases.Count > 0 Then
'get the first portal alias in the list and use that
For Each key As String In aliases.Keys
aliasKey = key
oPortalAliasInfo = aliases(key)
Exit For
Next
End If
'get the portal and correct TabId if available
Dim portal As PortalInfo = pc.GetPortal(PortalId)
If Not portal Is Nothing Then
If portal.SplashTabId > 0 Then
TabId = portal.SplashTabId
ElseIf portal.HomeTabId > 0 Then
TabId = portal.HomeTabId
End If
End If
If TabId > -1 Then
_portalSettings = New PortalSettings(TabId, oPortalAliasInfo)
End If
Else
_portalSettings = New PortalSettings(TabId, objPortalAliasInfo)
End If
app.Context.Items.Add("PortalSettings", _portalSettings)
The above may not be the best way to do this, but I could not think of a better way to get portalsettings without a TabId. It seems to work correctly, but should be reviewed for efficiency.
I would be glad to submit the code changes, but could not find the Gemini issue if it existed.
Here is a zip with the changes I made, including the assembly:
http://www.vivoware.com/HttpModules-C...