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 subclass DotNetNuke.Framework.PageBaseHow to subclass DotNetNuke.Framework.PageBase
Previous
 
Next
New Post
11/1/2008 10:12 AM
 

So I would like to make some custom web forms that will live in my dnn website, but I'd like them to have access to information about the current DNN portal - in other words have access to the PortalSettings class.

I noticed that the SiteMap.aspx web form gets this information by inheriting from the DotNetNuke.Framework.PageBase, which gives the page some more properties, such as PortalSettings. So I went ahead and subclassed from PageBase. Unfortunately, execution doesn't even make it to the Page_Load method of my page because an exception is thrown in Localization.GetEnabledLocales() when it tries to get the PortalSettings - PortalsSettings is null and thus I get a null exception...

As far as I can tell, I'm inheriting PageBase just as SiteMap.aspx does, and I don't see that SiteMap.aspx is doing anything special to make PortalSettings exist. What is so magical abot SiteMap.aspx that allows it to use PageBase like it does?

Here's what my code behind looks like:

namespace Kemmis.DNN.Examples
{
    public partial class GetTabs : DotNetNuke.Framework.PageBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //...
        }
    }
}

 

And here is what my aspx looks like:

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="GetTabs.aspx.cs" Inherits="Kemmis.DNN.Examples.GetTabs" %>

 

Any ideas?

 

 

 
New Post
11/1/2008 12:33 PM
 

I have not looked at this page but I'm thinking that if the Portal is in the URL you can get that and call the PortalSettings class, passing the PortalID.

If that works then the PageBase class is just a way for you to get to the PortalSettings class.



Michael Washington
http://ADefWebserver.com
www.ADefHelpDesk.com
A Free Open Source DotNetNuke Help Desk Module
 
New Post
11/1/2008 4:06 PM
 

Well I am essentially looking for elegant ways to get PortalId along w/ other PortalSettings information in instances where i'm not working with a module or skin object class. Of course I can always pass PortalId to it in the query string from any scenario where I have the value to pass, but that's not too elegant, and that value isn't always available (for instance when google requests the sitemap.aspx, it isn't able to pass the portalid)...

So I suppose my question might be generalized as How can I access the PortalId value from code other than what inherits from PortalModuleBase? For instance, I'd like to get the PortalId from the code-behind of a web form (.aspx), a web service (.asmx), or a ihttphandler (.axd).

In the past I have had to just hard-code a value in my file, which doesn't work against multiple portals... I'm sure many people have had this same question...

Thanks!

 
New Post
11/1/2008 7:39 PM
 

I guess my answer would be that a Portals really does not exists unless someone is trying to get to it. Meaning, DotNetNuke always asks "What Portal do you want to go to today?"

So you're right you do not have to pass the PortalID in the url, you can read the URL and then look in the PortalAlias table and figure out what portal the URL belongs to. This will give you the PortalID and with that you already know how to get the PortalInfo.



Michael Washington
http://ADefWebserver.com
www.ADefHelpDesk.com
A Free Open Source DotNetNuke Help Desk Module
 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0How to subclass DotNetNuke.Framework.PageBaseHow to subclass DotNetNuke.Framework.PageBase


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