Hello,
I am creating a custom module and would like to generate Friendly URLs in one module that links to a module on another page. I think that the FriendlyURL method is what I need, but I can't really figure out how to use it to get it to do what I want. Here is my function to generate the link:
Public Function GetModulePageURL(ByVal strModuleFriendlyName As String, ByVal strNodePath As String)
'GetModulePageURL = NavigateURL(TabId, "", "ID=" + strNodePath)
'User the following to navigate to the desired page that has your module control on it.
Dim mC As New ModuleController
Dim mi As DotNetNuke.Entities.Modules.ModuleInfo
mi = mC.GetModuleByDefinition(PortalSettings.PortalId, strModuleFriendlyName)
If Not mi Is Nothing Then
Dim tabTabInfo As New TabController
Dim ti As DotNetNuke.Entities.Tabs.TabInfo
ti = tabTabInfo.GetTab(mi.TabID, PortalSettings.PortalId, True)
GetModulePageURL = NavigateURL(mi.TabID, "", strNodePath)
GetModulePageURL = FriendlyUrl(ti, GetModulePageURL + "?" + strNodePath)
.......etc
This line: GetModulePageURL = NavigateURL(mi.TabID, "", strNodePath) produces:
"http://dnn_dev/MyGarage/tabid/486/Default.aspx?ID=44/102/56/51"
The next line: GetModulePageURL = FriendlyUrl(ti, GetModulePageURL + "?" + strNodePath) produces:
"http://dnn_dev/MyGarage.aspx"
Which is close to what I want...but I thought I'd get: "http://dnn_dev/MyGarage.aspx?ID=44/102/56/51"
I guess I really don't understand what the
path parameter in the FriendlyURL method is supposed to do. I see examples such as:
Example 2:
DotNetNuke.Services.Url.FriendlyUrl.FriendlyUrlProvider.Instance().FriendlyUrl(
new
TabController().GetTab(_tabId),
"~/Default.aspx?tabid="
+ _tabId
"&Parameter1=xyz"
,
"My_Custom_Page_Name.aspx"
);
This will result in the following url:
http://localhost/Tab_Page_Title/tabid/1/Parameter1/xyz/My_Custom_Page_Name.aspx
But I don't understand why you need to put in the ~/Default.aspx.... part. Why would you want to change MyGarage.aspx to Default.aspx which is obviously not a keyword? I guess I'm just really confused as to what the
Path param is supposed to do.
To be clear...this is what I'm looking for: "http://dnn_dev/MyGarage.aspx?ID=44/102/56/51"
How can I achieve this?
Second question:
And what is the custom page name about? I tried id and it generates that name, but that URL won't point to anything and will give a 404 error...I guess you need a custom parsing to convert it back first?
Thanks in Advance!
Chad