Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Would like some advice on how to get a specifc portal using Would like some advice on how to get a specifc portal using
Previous
 
Next
New Post
3/14/2009 6:47 PM
 

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

 
New Post
3/14/2009 8:02 PM
 

The child portal id is "7" and the main portal of course is 0

 
New Post
3/14/2009 9:08 PM
Accepted Answer 

Sorry I have resolved this issue,

i just modified this section and it was sotred,

 If LastSlash > 0 Then
                Dim objUserProfiles As New UserProfileController
                Dim objUserProfileInfo As UserProfileInfo = _
                    objUserProfiles.GetUserProfile(Me.PortalSettings.PortalId, strURL.Substring(LastSlash + CharSize).Replace("+", " "))

                Dim objUserProfiles2 As New UserProfileController
                Dim objUserProfileInfo2 As UserProfileInfo = _
                    objUserProfiles2.GetUserProfile(7, strURL.Substring(LastSlash + CharSize).Replace("+", " "))


                If Not objUserProfileInfo Is Nothing Then
                   Response.Redirect(DotNetNuke.Common.NavigateURL(TabId, "", "PID=" & objUserProfileInfo.UserProfileId.ToString()))
                End If
               
                If Not objUserProfileInfo2 Is Nothing Then
                    Response.Redirect(DotNetNuke.Common.NavigateURL(TabId2, "", "PID=" & objUserProfileInfo2.UserProfileId.ToString()))
                Else
                    Response.Redirect(DotNetNuke.Common.NavigateURL(TabId2))
                End If
            Else
                Response.Redirect(DotNetNuke.Common.NavigateURL())
            End If

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Would like some advice on how to get a specifc portal using Would like some advice on how to get a specifc portal using


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, 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 DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out