First off, I'm new to the forum, however I have been using DNN for a while now and I am an ASP.NET developer. I have not gotten too deep into the coding behind DNN, but I have a fair understanding.
I have installed DNN into a virtual directory: http://www.mydomain.com/myvirtual
I have configured the following entry in my web.config: <add key="HostHeader" value="/myvirtual" /> in order to have DNN filter out the /myvirtual application and make the site function as if it were hosted at the root level.
Now for my issues:
First - The install configured my default alias as: www.mydomain.com/install. I manually changed this in the SQL table and the site started and works fine. The issue I'm reporting here is the default install does not account for the "HostHeader" configuration properly.
Second - The default subhost.aspx does not account for the "HostHeader" configuration either. I have updated as follows:
<%@ Page Language="VB" %>
<%@ Import Namespace="DotNetNuke" %>
<script runat="server">
Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
Dim DomainName As String
Dim ServerPath As String
Dim ServerPathURL() As String
Dim URL() As String
Dim intURL As Integer
Dim HostHeader As String
' parse the Request URL into a Domain Name token
URL = Split(Request.Url.ToString(), "/")
' get the host header setting from web.config
HostHeader = Right(Config.GetSetting("HostHeader").ToLower, Len(Config.GetSetting("HostHeader")) - 1)
For intURL = 2 To URL.GetUpperBound(0)
Select Case URL(intURL).ToLower
Case "admin", "desktopmodules", "mobilemodules", "premiummodules"
Exit For
Case HostHeader
' filter the host header by skipping to the next
Case Else
' check if filename
If InStr(1, URL(intURL), ".aspx") = 0 Then
DomainName = DomainName & IIf(DomainName <> "", "/", "") & URL(intURL)
Else
Exit For
End If
End Select
Next intURL
' format the Request.ApplicationPath
ServerPathURL = Split(Request.ApplicationPath, "/")
For intURL = 0 To ServerPathURL.GetUpperBound(0)
Select Case ServerPathURL(intURL).ToLower
Case HostHeader
' filter the host header by skipping to the next
Case Else
ServerPath = ServerPath & IIf(ServerPath <> "", "/", "") & ServerPathURL(intURL)
End Select
Next intURL
If Len(ServerPath) > 0 Then
If Mid(ServerPath, Len(ServerPath), 1) <> "/" Then
ServerPath = ServerPath & "/"
End If
Else
ServerPath = "/"
End If
DomainName = ServerPath & "Default.aspx?alias=" & DomainName
Response.Redirect(DomainName, True)
End Sub
</script>
Now the child portal redirection functions properly. However, I am experiencing some anomalies and would like to know if this is to be expected or if there are plans to change the functionality.
Lets say I have a child portal with the alias of: www.mydomain.com/childportal, when the redirect occurs, the new URL is: http://www.mydomain.com/default.aspx?alias=www.mydomain.com/childportal and the portal site comes up. Now if you click on the "Home" breadcrumb you are then redirected to the following URL: http://www.mydomain.com/childportal/Home/tabid/<portalhometabid>/Default.aspx, which is actually what I would like to happen directly from the subhost.aspx, but I am not sure if that is possible or not. Now, if you click on the "Home" breadcrumb again you are redirected to yet another URL: http://www.mydomain.com/myvirtual/Home/tabid/<portalhometabid>/Default.aspx. And from now on you stay on the /myvirtual/ directory structure. Why does this happen? And how can I keep everything under the /childportal/ directory structure?
My apologies for posting such a long and complicated first post, but the anomalies are very much dependent on the steps as I have indicated.