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

HomeHomeUsing DNN Platf...Using DNN Platf...Using Modules a...Using Modules a...How to make modules compatible with older DNNHow to make modules compatible with older DNN
Previous
 
Next
New Post
8/23/2011 7:27 AM
 
Hi
I'm writing a module that I want to work on all DNN 4 and 5 versions.
I'm stumbling on how best to write my code.  As an example I'm finding out if the current page is set to use SSL.  In DNN 5 and later versions of 4 there is a property IsSecure on the TabInfo class.   But in early versions of 4 the idea of making pages secure doesn't exist.
How should I write some code without having to provide a different version of an install file for different DNN versions?
 
New Post
8/23/2011 8:03 AM
 
whilst you can do version identification (e.g heres someone using it to determine whether to add jqueryui - http://www.ifinity.com.au/Blog/EntryI... ), the problem is that if you want to use the API the methods will not exist in earlier versions and so the code will not compile. Whilst you can do some things with late binding and dynamics to avoid this, that often will mean your code does not run in partial trust scenarios. The typical way to develop for particular versions is to add that DotNetNuke version to your solution file and reference its dotnetnuke.dll in your module project - that way you only target API elements available in that version.

If you want to ensure users cant install a module without being on a particular version you can use the compatibleversions node (http://www.dotnetnuke.com/Resources/B...) or (and bettter) the dependency node and coreversion (http://www.dotnetnuke.com/Resources/W...) however the dependency node only exists in dnn5.0 and above.

Finally, if you really want you can make seperate manifest files - with the 5.0 and 6.0 releases we added support for major version targetting i.e. it's possible to create  mark.dnn, mark.dnn5 and mark.dnn6 manifest files -though we imagine these will only be used for certain edge cases.

Buy the new Professional DNN7: Open Source .NET CMS Platform book Amazon US
 
New Post
8/24/2011 4:57 AM
 
Great. Thanks for that.

I like the look of the Reflection code in the iFinity blog. I have used that and got it working. What is your concern about it not working in partial trust environments?

I've used the below code to determine if the IsSecure property is available and then to call it (with Reflection) if so.
I changed the trust setting in my web config on my localhost to Medium and the code still runs fine so does that mean it wont be an issue for me?

if (HasProperty(page, "IsSecure"))
{
Type tabInfoType = Type.GetType("DotNetNuke.Entities.Tabs.TabInfo, DotNetNuke");
if (tabInfoType != null)
{
//run the DNN 5.0 specific jQuery registration code
//tabInfoType.InvokeMember("IsSecure", System.Reflection.BindingFlags.InvokeMethod | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static, null, tabInfoType, null);
PropertyInfo IsSecureProp = tabInfoType.GetProperty("IsSecure", typeof(bool));
SSLMessage.Visible = (bool)IsSecureProp.GetValue(page, null);
}
}
 
New Post
8/24/2011 5:36 AM
 
yes it looks fine - the issue is if you have to use private (non-public reflection)

Buy the new Professional DNN7: Open Source .NET CMS Platform book Amazon US
 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Using Modules a...Using Modules a...How to make modules compatible with older DNNHow to make modules compatible with older DNN


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