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

HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...How I got my FriendlyUrl QueryString to workHow I got my FriendlyUrl QueryString to work
Previous
 
Next
New Post
8/31/2007 4:19 PM
 

I was having interesting issues trying to get a query string to work. I was using the method Return DotNetNuke.Common.NavigateURL(Me.TabId, arrayOfStrings)

The link returned inserted "ctl/(control_id/" into the string.  With this string, the page requested will not execute page load. I can insert a break point, and it will not hit. If I remove ctl/58  (whatever the control id is), then the query string works.  I have a regex expression to remove the ctl/id from the string.  But I am thinking there must be some overload that does this automatically.

I am using the following code inorder to get a QueryString to work (I had to HACK):

''' <summary>
        '''
        ''' </summary>
        ''' <param name="countryAbbreviation">The value for the country query parameter</param>
        ''' <param name="regionAbbreviation">The value for the region query parameter</param>
        ''' <param name="cityName">The value for the city query parameter</param>
        ''' <returns>DNN NavigateUrl QueryString</returns>
        ''' <remarks>jfs 08-31-07</remarks>
        Private Function BuildNavigateUrl(ByVal countryAbbreviation As String, _
            ByVal regionAbbreviation As String, ByVal cityName As String) As String
            Dim navUrl As String = DotNetNuke.Common.NavigateURL()

            Dim params As New Generic.List(Of String)()
            If Not countryAbbreviation Is Nothing Then
                If Not String.IsNullOrEmpty(countryAbbreviation) Then
                    params.Add(String.Concat(CountryKeyName, "=", countryAbbreviation))
                    If Not regionAbbreviation Is Nothing Then
                        If Not String.IsNullOrEmpty(regionAbbreviation) Then
                            params.Add(String.Concat(RegionKeyName, "=", regionAbbreviation))
                            If Not cityName Is Nothing Then
                                If Not String.IsNullOrEmpty(cityName) Then params.Add(String.Concat(CityKeyName, "=", cityName))
                            End If
                        End If
                    End If
                End If
            End If

            Dim arrayOfStrings(params.Count) As String
            Dim i As Integer = 0
            For Each param As String In params
                arrayOfStrings(i) = param
                i += 1
            Next

            'Return DotNetNuke.Common.NavigateURL(Me.TabId, arrayOfStrings)
            Return Regex.Replace(DotNetNuke.Common.NavigateURL(Me.TabId, arrayOfStrings), "ctl/\w\d*/", "")

        End Function

 

Has anyone had issues with a FriendlyUrl QueryString?  With this RegularExpress, all my query strings are now working in FriendlyURL format.

The question is WHY is the ctl=value parameter being inserted for me?  It mirrors the tab id in my case, and one reason this have misfired is likely the value of ctl may not be valid. I did not look into the DB to find out.  Any thoughts on this would be appreciated. Thank you.

 

 
New Post
9/3/2007 10:31 PM
 
Hi,

Try using:

Return DotNetNuke.Common.NavigateURL(Me.TabId, "", arrayOfStrings)

This sends a blank control key to the NavigateURL routine.

Hope this helps!


Shawn
 
New Post
9/7/2007 2:52 PM
 

Right you are!  I also modified the Regex Expression.  Here is what I use:

Dim key As String = String.Format("mid={0}", Me.ModuleId) 'This can be that empty string you speak of
            If (arrayOfStrings.Length >= 1) Then
                Return Regex.Replace(DotNetNuke.Common.NavigateURL(Me.TabId, key, arrayOfStrings), "ctl/?\d*?/mid/", "")
                'Return DotNetNuke.Common.NavigateURL(Me.TabId, key, arrayOfStrings)
            Else
                Return NavigateURL(Me.TabId)
            End If

 

 
Previous
 
Next
HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...How I got my FriendlyUrl QueryString to workHow I got my FriendlyUrl QueryString to work


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