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

HomeHomeDevelopment and...Development and...DNN Platform (o...DNN Platform (o...DNN 5.5 - Access Host SettingsDNN 5.5 - Access Host Settings
Previous
 
Next
New Post
9/2/2010 3:58 AM
 
I have a custom module I've written in DNN v4.94 which needs to access a custom host setting. My code is as follows:

Dim HPS As Entities.Portals.PortalSettings
HPS = GetHostPortalSettings()
strHostURL = HPS.HostSettings.Item("HostDomain")

However when I use this in V5.5, I get the warning
"Deprecated in DNN 5.0. Replaced by Host.GetHostSettingsDictionary"

So I try to use Host.GetHostSettingsDictionary using code like this:

strHostURL = DotNetNuke.Entities.Host.Host.GetHostSettingsDictionary("HostDomain")

This time I get the warning
"Replaced in DotNetNuke 5.5 by HostController.GetHostSettingsDictionary()"

So I tried this:

Dim HostCtr As New DotNetNuke.Entities.Controllers.HostController

But get an error:

'DotNetNuke.Entities.Controllers.HostController.Friend Sub New()' is not accessible in this context because it is 'Friend'

I have checked the SuperUser Manual and search DNN (via www.SearchDotNetNuke.com) and can't find any help. Is there a programmers reference guide to DNN V5.5?

Can anyone hlp by showing me an example piece of code for V5.5 just to extract a Host Setting called "HostDomain"?


Blue & White hooped blood runs through my veins!
 
New Post
9/2/2010 7:40 AM
 
that obsolete message is out of date - it's now hostcontroller.instance.getsettingsdictionary AFAIR (don't have source) -the hostcontroller was changed to be interfaced and support containers for better testability

Buy the new Professional DNN7: Open Source .NET CMS Platform book Amazon US
 
New Post
9/2/2010 7:48 AM
 
thanks Cathal, but how do I declare the HostController?

I try this:

hostcontroller.instance.getsettingsdictionary()

and it has a error: hostcontoller not declared

I try to declare a host controller like this:

Dim hstctrl As New DotNetNuke.Entities.Controllers.HostController

And it has an error:  'DotNetNuke.Entities.Controllers.HostController.Friend Sub New()' is not accessible in this context because it is 'Friend'

Am I missing something glaringly obvious?

 

 
New Post
9/2/2010 8:09 AM
 
i suspect you have the wrong namespace imports, it's in the DotNetNuke.Entities.Controllers namespace . There is no public construtor so you can't "New" up an instance, you just use hostcontroller.instance.methodname(parameter) and the core code takes care of identifying what that instance refers to and it's caching. This means that we can substitute an alternative definition in our unit testing code.

Buy the new Professional DNN7: Open Source .NET CMS Platform book Amazon US
 
New Post
9/2/2010 8:14 AM
 
Thanks Cathal, I think I've got it now: strHostURL = DotNetNuke.Entities.Controllers.HostController.Instance.GetSettingsDictionary("HostDomain")
 
Previous
 
Next
HomeHomeDevelopment and...Development and...DNN Platform (o...DNN Platform (o...DNN 5.5 - Access Host SettingsDNN 5.5 - Access Host Settings


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