DotNetNuke NavigateURL() returns FriendlyUrls, which is not always suitable.

My DotNetNuke site  has HostSetting("UseFriendlyUrls") = "Y", which is generally good.

The most popular function used in DNN to generate url is NavigateURL.
However when I want to get Page Url and then add additional query parameters, NavigateURL() is not the best choice.
NavigateURL returns FriendlyUrl, and after adding extra parameters (e.g.
http://localhost/FSDNN/vKnowledgeDataEditing/tabid/59/Default.aspx?List=SubscriptionSearchInterest ) the structure of URL becomes different to what HttpModules.UrlRewrite expects.

HttpModules.UrlRewrite replaces TabId to -1 and appropriate page is not found.

The solution is to use = ApplicationURL(Tabid)

sUrl

instead of NavigateURL and then add QueryString parameters manually.

Overloads of NavigateURL have AdditionalParameters parameter ,that probably was designed by DNN authors to add arbitrary query parameters.
It is possible to parse multiple QueryString parameters into array of string AdditionalParameters and then pass it to appropriate .Sample how to split QueryString into AdditionalParameters array of string is in DNN Default.aspx.vb InitializePage function.

Unfortunautely default FriendlyUrls implementation moves parameters into part of the path ,but default UrlRewrite HttpModule unable to restore them back.
I don't have enough experience with Rewrite rules to fix it, so using ApplicationURL is a good alternative for me.

 

 
posted @ Tuesday, January 17, 2006 7:42 AM
Print

Comments on this entry:

# re: DotNetNuke NavigateURL() returns FriendlyUrls, which is not always suitable.

Left by Sheldon Cohen at 2/18/2007 3:55 AM
Gravatar
Would this work?

string urlArgs = string.Format("mid={0}{1}", ModuleId, args);
string returnString = Globals.NavigateURL(TabId, key, urlArgs);
return returnString;

# re: DotNetNuke NavigateURL() returns FriendlyUrls, which is not always suitable.

Left by Michael Freidgeim at 2/18/2007 9:42 AM
Gravatar
From the memory, the correct syntax should be

string urlArgNew = string.Format("mid={0}", ModuleId);

string arrOfStrings() as string={ urlArgNew,"Agg1=Val1","arg2=value2")

string returnString = Globals.NavigateURL(TabId, key, arrOfStrings);

# re: DotNetNuke NavigateURL() returns FriendlyUrls, which is not always suitable.

Left by Sheldon Cohen at 2/20/2007 3:11 PM
Gravatar
Cool, thanks my man.

# re: DotNetNuke NavigateURL() returns FriendlyUrls, which is not always suitable.

Left by nix at 6/11/2008 2:30 AM
Gravatar
Hi,
How would I create a link to a document located on the file system using navigateUrl? I tried everything, but it always point to the relative path. Thanks.

# re: DotNetNuke NavigateURL() returns FriendlyUrls, which is not always suitable.

Left by Michael Freidgeim at 6/11/2008 9:38 AM
Gravatar
I am not working with DNN for more than a year, but from memory Globals.NavigateURL is used to create URL for tabID.
You should not use it for files located on the file system.

# re: DotNetNuke NavigateURL() returns FriendlyUrls, which is not always suitable.

Left by Dotnetnuke module development at 7/31/2008 2:49 AM
Gravatar
Thanks for the tip about Globals.ApplicationURL. We were having some problems with a module in combination with the friendly url function. So in stead of using Globals.NavigateUrl and adding the additional querystrings we implemented Globals.ApplicationUrl and added the querystrings to that and it works great.

# re: DotNetNuke NavigateURL() returns FriendlyUrls, which is not always suitable.

Left by almny at 6/3/2009 4:45 PM
Gravatar
i want to redirect from module to anouther module
how i can do it ?

# re: DotNetNuke NavigateURL() returns FriendlyUrls, which is not always suitable.

Left by Bassam at 8/18/2009 6:12 AM
Gravatar
How Can I send QweryString parms when navigate to a page from Main Menu
Thanks.,

Your comment:



(not displayed)

 
 
 
 
 

Live Comment Preview:

 
«November»
SunMonTueWedThuFriSat
2627282930311
2345678
9101112131415
16171819202122
23242526272829
30123456