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

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesGet current page URLGet current page URL
New Post
5/18/2011 4:16 AM

I think I am approaching the solution of my problem. I hope that this is my last question but can you tell me how to make sure that there is not an existing field in the keys collection. You can see my code below but some keys like the language and tabid exists two times in my URL.

Dim NewQuery As String = ""

For Each key In Request.QueryString.Keys

    Dim Value As String = Request.QueryString(key)

    NewQuery &= "&" & key & "=" & Value


Dim URL As String = NavigateURL(TabId, "", NewQuery)

New Post
5/18/2011 7:35 PM
You can just keep a duplicate check of the keys you've already added.

Something like:

List<string> keys = new List<string>();

foreach key in querystring.keys

    if (keys.contains(key) == false)


        newQuery+= "&" + key + "=" + querystring[key]



New Post
5/19/2011 1:31 AM

I know how to check the duplicated values in my code. The problem is that I have to check all the keys including the keys that DNN creates. Some Keys like tabid and language are keys which are used by the DNN framework. Even when I make the check for the keys that I get inside the loop, the tabid and language are included twise. The first appearance caused by me and the other by the DNN framework. In order to make the check I added the X character in front of the key and its value in order to know which key is created by me and which by the DNN. So when I have the following URL:


The generated url by my code is the following:


Now you will see that TabID exists 2 times in the generated URL. The first has not the X character in front of its name which means that it is automatically generated by the DNN framework and the other has the X Character which tells me that I created this key.

So I have to find a way to check if a key is used by DNN framework. I cannot assume that tabid and language is used by dnn because it does not used all the time. For example language is used only when we have Multilanguage pages in our site. There are also some other keys which are used by dnn in various occasions. If I remember well the PortalID or something like this is used when we have multiple portals.

New Post
5/19/2011 5:55 AM
Ok, so you don't know which in-built parameters DNN is going to include in the Url, so you don't know which to keep out.

Basically, flip the problem over- you do know which values you use in your module - perhaps look through the Url and ignore all those keys that you don't recognise - ie, which aren't related to your module.  So look through for productId, use it if it is there, and likewise for any other values you would expect your module to put in the Url.

You could build a list of expected DNN key values - there isn't that many.  Off the top of my head, these are the ones I can think of:








There will be a few others, but it's not that big a list, so you coudl conceivable check against it.

New Post
5/19/2011 7:28 AM

Sometimes I wonder why a small number of lines of code cause me to spend so many hours in front of my laptop trying to find a solution. I started a new search from the beginning spending some time trying to find all the different ways of getting information about the current url. After combining various properties, I created the following code in order to get the URL of the current page.

Dim CurrentURL As String = ""

If (Request.IsSecureConnection) Then

    CurrentURL = "https://" & Request.Url.Host & Request.RawUrl


    CurrentURL = "http://" & Request.Url.Host & Request.RawUrl

End If

I suppose that DNN development team should create a property which will give this information to the module developers.

I would like to thank everyone who replied to this thread.

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesGet current page URLGet current page URL

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