Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0how to create urlhow to create url's to pages dynamically [urgent]
Previous
 
Next
New Post
12/12/2007 6:26 AM
 

What I want to do here is create an url to a page with a module I created myself and send it to someone by email.
I'm really stuck here and got to get this workin asap so hope someone can help me out here.

I don't know how I have to compose the url in my code. When composing the url I also need to know on wich portal I am.

so in pseudo code this is what I want to do:
if portal id = 1 then strhost = http://www.mydomainname.be
if portal id = 0 then strhost = http://www.mydomainname.nl
linkIWantToSend = strhost & GetThePrivacyPageUrlFromDnn (which is a different tabid for the be and the nl portal)
AnotherLinkIWantToSend = strhost & GetThePageWithMyCustomModuleFromDnn & MyCustomParameters

Message = Link1: linkIWantToSend & link2: linkIWantToSend

All help appreciated!

 
New Post
12/12/2007 8:27 AM
 

If I understand you correctly, here is how you can get the URL to the privacy tab (assuming that you want to be on the homepage of the portal):

Dim ctlTab As New DotNetNuke.Entities.Tabs.TabController
Dim portalStgs As DotNetNuke.Entities.Portals.PortalSettings = DotNetNuke.Entities.Portals.PortalController.GetCurrentPortalSettings
Dim tabInfo As New DotNetNuke.Entities.Tabs.TabInfo
tabInfo = ctlTab.GetTab(portalStgs.HomeTabId, portalStgs.PortalId, True)
Dim strUrl As String = System.Text.RegularExpressions.Regex.Replace(tabInfo.FullUrl, "(Default\.aspx)", "ctl/Privacy/Default.aspx")

Please note that in the example above, you can remove the namespaces in most modules.  Also, the PortalSettings are typically already available through the ModuleBase Class.  I only included them here for context.

Here is how you would do that same thing in a typical module:

Dim ctlTab As New TabController
Dim tabInfo As New Entities.Tabs.TabInfo
tabInfo = ctlTab.GetTab(Me.PortalSettings.HomeTabId, Me.PortalSettings.PortalId, True)
Dim strUrl As String = System.Text.RegularExpressions.Regex.Replace(tabInfo.FullUrl, "(Default\.aspx)", "ctl/Privacy/Default.aspx")

Here is how you do it for the current tab:

Dim strUrl As String = System.Text.RegularExpressions.Regex.Replace(Me.PortalSettings.ActiveTab.FullUrl, "(Default\.aspx)", "ctl/Privacy/Default.aspx")

Will Strohl

Upendo Ventures Upendo Ventures
DNN experts since 2003
Official provider of the Hotcakes Commerce Cloud and SLA support
 
New Post
12/12/2007 11:34 AM
 

Thanks alot! I'm going to try this first thing tomorrow.

One thing I am wondering though: 
Say I got this page: http://www.mydomain.be/Wedstrijd/tabid/56/Default.aspx  ==>> It is a page I created and it holds a module I have written. on my other portal this same page has tabid 58
now I want to put the link to this page in the email but the email is getting sent from another page. Is there also a way to get the tabid from my "Wedstrijd"-page dynamically without hardcoding??





so basically I need to use the way in your above post + I need to  get the TabId where Tabname = Wedstrijd right? is it possible to get the TabId this way?? or do I have to write my own Stored procedure that selects the tabid from the database where the tabname = "Wedstrijd" and the portalid = the current portal id? And what if I have 2 tabnames with the name "Wedstrijd" in my database(that is not the case but well... it is possible)

Thanks in advance!

 
New Post
12/13/2007 5:59 AM
 

Allright I have tried it but...
... the method above gives me: \DNN_Development/DNN_Development/Home/tabid/36/ctl/Privacy/Default.aspx

1. So I need to replace the \ by a / but I get an error on trying to do that. it says the \ is an invalid character. How can I fix this?

2. Also I need to add the domain name infront of the url. If I add Server.Mappath("~") infront of it I get C:\SITES instead of http://localhost:3494 wich I need. How can I fix this?

3. I also need to know what I described in the above post how to get the tabid from a custom page of which I only know the title in advance.

Greetz,

Sen

 

 
New Post
12/15/2007 4:19 PM
 

Your concerns are valid.  The most efficient way to get the tab dynamically like you want is to pull it using a Stored Procedure, because the alternative is to iterate through the entire collection of tabs in your portal looking for the tab in question.  However, as you pointed out, it is indeed possible to have two different pages with the same name, so you could potentially (though not likely) return the wrong page.  This leads me to another point though.  I do not think that the database is optimized for queries on the tab name (index).  So, if your portal is large, this might be a slow query.


Will Strohl

Upendo Ventures Upendo Ventures
DNN experts since 2003
Official provider of the Hotcakes Commerce Cloud and SLA support
 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0how to create urlhow to create url's to pages dynamically [urgent]


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out