Reputation: 6829
If I use this:
Request.Url.AbsoluteUri
I get full url like:
http://localhost/mysite/Default.aspx?TabID=269&OTHER-parameters
But I don't want this thing with TabID I need friendly url so if I use:
DotNetNuke.Entities.Tabs.TabController.CurrentPage.FullUrl;
I get
http://localhost/mysite/something/en-us/generatethings.aspx
But with this I don't get parameters :(
How to get full friendly complete url from dnn with all parameters?
Upvotes: 3
Views: 6354
Reputation: 51
`string url = TabController.CurrentPage.FullUrl;`
this should give you the user friendly url
Upvotes: 2
Reputation: 155905
Unfortunately, there isn't an easy way to get the current URL within DNN, because the URL gets rewritten before it gets to your module.
What we'll typically do is regenerate the URL, using Globals.NavigateURL
. You can use DotNetNuke.Common.Utilities.UrlUtils.GetQSParamsForNavigateURL
to get all of the query string parameters from the current URL.
So, you'd end up with something like this:
var currentUrl = Globals.NavigateURL(
this.TabId,
this.Request.QueryString["ctl"],
UrlUtils.GetQSParamsForNavigateURL());
Upvotes: 6
Reputation: 114
I think this will get you what you want
string url = HttpContext.Current.Request.Url.Scheme + "://" + HttpContext.Current.Request.Url.Authority + HttpContext.Current.Request.RawUrl;
Upvotes: 4