Geeks With Blogs

Michael Freidgeim's Blog MS .Net Development

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 on Tuesday, January 17, 2006 7:42 AM | Back to top


Comments on this post: DotNetNuke NavigateURL() returns FriendlyUrls, which is not always suitable.

# re: DotNetNuke NavigateURL() returns FriendlyUrls, which is not always suitable.
Requesting Gravatar...
Would this work?

string urlArgs = string.Format("mid={0}{1}", ModuleId, args);
string returnString = Globals.NavigateURL(TabId, key, urlArgs);
return returnString;
Left by Sheldon Cohen on Feb 18, 2007 3:55 AM

# re: DotNetNuke NavigateURL() returns FriendlyUrls, which is not always suitable.
Requesting 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);
Left by Michael Freidgeim on Feb 18, 2007 9:42 AM

# re: DotNetNuke NavigateURL() returns FriendlyUrls, which is not always suitable.
Requesting Gravatar...
Cool, thanks my man.
Left by Sheldon Cohen on Feb 20, 2007 3:11 PM

# re: DotNetNuke NavigateURL() returns FriendlyUrls, which is not always suitable.
Requesting 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.
Left by nix on Jun 11, 2008 2:30 AM

# re: DotNetNuke NavigateURL() returns FriendlyUrls, which is not always suitable.
Requesting 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.
Left by Michael Freidgeim on Jun 11, 2008 9:38 AM

# re: DotNetNuke NavigateURL() returns FriendlyUrls, which is not always suitable.
Requesting 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.
Left by Dotnetnuke module development on Jul 31, 2008 2:49 AM

# re: DotNetNuke NavigateURL() returns FriendlyUrls, which is not always suitable.
Requesting Gravatar...
i want to redirect from module to anouther module
how i can do it ?
Left by almny on Jun 03, 2009 4:45 PM

# re: DotNetNuke NavigateURL() returns FriendlyUrls, which is not always suitable.
Requesting Gravatar...
How Can I send QweryString parms when navigate to a page from Main Menu
Thanks.,
Left by Bassam on Aug 18, 2009 6:12 AM

Your comment:
 (will show your gravatar)


Copyright © Michael Freidgeim | Powered by: GeeksWithBlogs.net | Join free