Hi everyone.
I am extending my portal and I have run into an issue and I have been trying to resolve it. I do not think I am clear enough on what the parts of the framework are doing and i am hoping some one can help me out and clarify some stuff or point me in the right direction for some helpful resources.
I currently have this embedded on my not found "404" page . I have Unique URLS for my users profiles for example;
http://r8yourpolitician.co.uk/RoyBeggs
What happens if some tries to search for the URL above, the server calls my modified 404 not found page and the following code executes and what it does is it takes the URL, Checks the name against the usres profile and then pulls the UsersProfileID and then redirects the user to the intended profile based on the UsersProfileID.
The UserProfile URL is like this : http://www.r8yourpolitician.co.uk/Politicians/tabid/148/PID/8/Default.aspx
This works fine no problems at all on the main portal its only on the child portals it does not work..
Dim TabId As Integer
Try
Dim fname As String = Server.MapPath(Me.PortalSettings.PortalId & "-" & "URLRedirect.tab")
Dim s As New StreamReader(fname)
TabId = CInt(s.ReadLine)
s.Close()
Catch ex As Exception
TabId = -1
End Try
If TabId <> -1 Then
Try
Dim strURL As String = Server.HtmlDecode(Request.QueryString.ToString)
Dim CharSize As Integer = 3
Dim LastSlash As Integer = strURL.LastIndexOf("%2f")
If LastSlash <= 0 Then LastSlash = strURL.LastIndexOf("/") : CharSize = 1
If LastSlash <= 0 Then LastSlash = strURL.LastIndexOf("\") : CharSize = 1
If LastSlash > 0 Then
Dim objUserProfiles As New UserProfileController
Dim objUserProfileInfo As UserProfileInfo = _
objUserProfiles.GetUserProfile(Me.PortalSettings.PortalId, strURL.Substring(LastSlash + CharSize).Replace("+", " "))
If Not objUserProfileInfo Is Nothing Then
Response.Redirect(DotNetNuke.Common.NavigateURL(TabId, "", "PID=" & objUserProfileInfo.UserProfileId.ToString()))
Else
Response.Redirect(DotNetNuke.Common.NavigateURL(TabId))
End If
Else
Response.Redirect(DotNetNuke.Common.NavigateURL())
End If
Catch ex As Exception
End Try
End If
I have now created a child portal called "users" and a typical users profile URL is like this to reflect the child portal,
http://www.r8yourpolitician.co.uk/users/ECitizen
The problem i am having now is that when a user browses to a new profile URL on the child portal it redirects to the default page profile page on the main portal as if the URL was not found on the main portal. It behaves as if the URL of the child is trying to search for USER in the main portal and he/she does not exsist and thus redirects to the default page.
Can anyone help me modify the of code above so that it checks to see if the User from the URL is for the main portal or the child portal. Currently it gets the root portal i need to somehow specify the child portal and then do a search against it.
Something like
- capture URL
- search module on main portal for USER in URL
- if found
- redirecd as normal
- else
- search module for user in URL in child portal
- if found
- redirect to USER proile
I really just need to knoiw where i add the child portal bit of string to the current source code , or away to specificy the child portal to make
http://www.r8yourpolitician.co.uk
become
http://www.r8yourpolitician.co.uk/users
The rest of the logic if/else stuff I can do alright, im just looking some advice regarding the following
- Server.MapPath(Me.PortalSettings.PortalId & "-" & "URLRedirect.tab")
- objUserProfiles.GetUserProfile(Me.PortalSettings.PortalId, strURL.Substring(LastSlash + CharSize).Replace("+", " "))
- Response.Redirect(DotNetNuke.Common.NavigateURL(TabId, "", "PID=" & objUserProfileInfo.UserProfileId.ToString()))
kind regards
P