Reputation: 73
I want to get Full URL including URL Parameter in my module code.
For example
From This URL
http://Domain/Search-Space-For-Rent/Houston
TabController.CurrentPage.FullUrl
Gives me
//Domain/Search-Space-For-Rent
only I need to get last parameter from URL (Houston)
I also tried
Globals.NavigateURL(this.TabId, this.Request.QueryString["ctl"], UrlUtils.GetQSParamsForNavigateURL());
How can I get that?
Upvotes: 0
Views: 1946
Reputation: 8943
Typically within DNN you would simply get from the QueryString ex:
var myParam = Request.Querystring["paramName"];
What parameter name are you using when you build that URL? I would assume you've got a custom URL provider that changing something like "&city=Houston" to be /Houston instead. If that is the case, just grab the querystring paramter called City.
Update: To get the "Name" of the page, assuming the scenario where Houston is a page in DNN, you could do the following.
var tc = new TabController();
var ti = tc.GetTab(TabId);
var pageName = ti.TabName
TabId comes from DNN, assuming your module inherits from PortalModuleBase you should have access to it. With that, you can then get the TabInfo from the TabController, and access the properties off that TabInfo object.
Upvotes: 1
Reputation: 73
So I regenerated URL using all query string parameters.
string path = TabController.CurrentPage.FullUrl;
foreach (string key in Request.QueryString.AllKeys)
{
if (key != "TabId" && key != "language" && key != "_escaped_fragment_")
{
if (key != null)
{
path += "/" + key + "/" + Request.QueryString[key];
}
else
{
path += "/" + Request.QueryString[key];
}
}
}
Upvotes: 1