Blogs

DNN Navigation Redirect With Parameters and No Control

08 Jun

 

When working with DotNetNuke I often find it necessary to do a redirection back to the current page, with additional querystring parameters.  Not actually switching views, but just back to the same page so that some other action could be taken for a specific module.  In the past most of the examples I found used this process.

DotNetNuke.Common.Globals.NavigateUrl(this.TabId) + "?mykey=myvalue"

Which would create a url such as

http://www.mysite.com/MyFolder/Default.aspx?mykey=myvalue

Although a fully functional URL that works 100%, it is not something that can be easily copied, and overall doesn't look all that fancy.  Looking through the functionality of the various NavigateUrl overloads, it didn't seem apparent that there was something that could be used to re-write that type of URL.  Well I missed something using the following code.

DotNetNuke.Common.Globals.NavigateUrl(this.TabId, "", "mykey=myvalue")

From this example we provide the tabId, a blank ControlKey, and then our added parameter value.  We could add additional parameters as well.

This results in a URL similar to the following.

http://www.mysite.com/MyFolder/mykey/myvalue/Default.aspx

Now, this is a fully re-written URL, and something much easier for a person to remember.  I hope this has been helpful!

tags: DNN, DNN Development
comments powered by Disqus

Content provided in this blog is provided "AS-IS" and the information should be used at your own discretion.  The thoughts and opinions expressed are the personal thoughts of Mitchel Sellers and do not reflect the opinions of his employer.

Connect with Mitchel

I hope the information here has been helpful. To stay connected you can also subscribe to blog updates via email, contact Mitchel about consulting services, or reach out for assistance via CodeMendor

Content Copyright

Content in this blog is copyright protected.  Re-publishing on other websites is allowed as long as proper credit and backlink to the article is provided.  Any other re-publishing or distribution of this content is prohibited without written permission from Mitchel Sellers.