DotNetNuke Hosting with ASPHostPortal.com

BLOG about DotNetNuke CMS, latest technology and Special DotNetNuke Hosting Package with ASPHostPortal.com

DotNetNuke Hosting with ASPHostPortal.com :: Security Actions to Safeguard Your DotNetNuke CMS

clock Desember 18, 2014 05:46 by author Ben

DNN Security Out Of the Box
DNN (DotNetNuke) is currently the premier CMS of the US Government as a result of it's robust security and integration with current safety functions. Nevertheless even DNN is not totally excellent out of the box, and there are numerous additional safety attributes that can be put in location depending on your particular DNN eCommerce requirements. These security suggestions variety from easy to complex and cover many various aspects of possible security risks. No guide can accurately assess your particular safety requirements. In the event you would prefer to adequately secure your DNN web site, contact Clarity these days.

Improve Password Complexity and Use Specifications

Increasing password complexity is among the easiest and most successful methods to significantly boost security. Probably the most common and successful requirements are length and complexity. eight or much more characters along with a minimum of a single capital letter, one lowercase letter and 1 number is a good begin. You are able to contemplate requiring a non-alphanumeric character as well as putting restrictions on how lengthy a password may be used. Even with powerful password needs, you might be only preventing against brute force attacks.

Modify 'Host' and 'Admin' Passwords and Limit Their Use

Altering the Host and Admin password to incredibly complicated passwords is the single most successful step for safety, as each accounts are recognized to exist and are the most vulnerable to brute force attacks as a result of that. Make sure that any password you set for these accounts exceeds the password recommendations listed above. You should also think about limiting access to these accounts, as they may be essentially the most powerful accounts and would leave your site essentially the most vulnerable if they have been compromised.

Hash Password Storage

By default DotNetNuke utilizes encryption of user passwords. This provides a good degree of protection, and enables you to retrieve your password as encryption is a reversible operation. Nonetheless, should you usually do not want to help password retrieval, or want to make certain maximum protection, you may select to utilize Hashing as an alternative. Hashing is really a non-reversible operation, so even if your database is accessed or stolen, a hacker can't reverse engineer your password.

 



DotNetNuke 7.3 Hosting - ASPHostPortal.com :: How to Navigate to Another Page from DotNetNuke Custom Module

clock Desember 8, 2014 07:43 by author Dan

Today, we will explain about Navigating to Another Page from DotNetNuke Custom Module. In a few circumstances, there is a prerequisite to add usefulness that permits clients to explore from one page then onto the next in Dotnetnuke Custom Module. For instance, in the event that you have a custom module called "Register" and the client has successfully registered, you may need to explore the client to an alternate page to view client login detail where an alternate custom module as of now been included request to view login client detail.

In Dotnetnuke module we require the Tab Id of the page so as to explore to an alternate page.So to attain this we can include a dropdown field in Edit page of our custom module(register) to demonstrate all the accessible Tab/ Page names of DNN site where client can choose the Page name to redirect which  inside keeps the Tab Id as quality. Then, we can utilize that Tab Id value as a part of request to explore to other page.

[Code in C#]

EditRegister.ascx

//Adding a Dropdown field in EditRegister.ascx page to allow admin or host to select the redirect page name
<asp:DropDownList ID="ddlTabNames" runat="server"></asp:DropDownList>

EditRegister.ascx.cs

//Adding available page names to the dropdown using object of TabController
if (Page.IsPostBack == false)
{
       DotNetNuke.Entities.Tabs.TabController objTabController = new DotNetNuke.Entities.Tabs.TabController();
 
        ArrayList arrlTabs = null;
        arrlTabs = objTabController.GetTabs(this.PortalId);

        string strKey = string.Empty;
        string strValue = string.Empty;

        ddlTabNames.Items.Clear();
 
       //Get the tabname and tabid of each tabs or page using object of TabInfo and added to dropdownlist field
        foreach (Entities.Tabs.TabInfo objTab in arrlTabs)
        {
            strKey = objTab.TabName;
            strValue = objTab.TabID.ToString();

            ddlTabNames.Items.Add(new ListItem(strKey, strValue));
        }
}

       //Using ModuleControler object we need to save selected Page TabId in module specific variable
        ModuleController objController = new ModuleController();
        objController.UpdateModuleSetting(this.ModuleId, "TabID", ddlTabNames.SelectedValue);

ViewRegister.ascx.cs

       Now From custom module view page we can redirect to another Page or Tab of DNN website using following code

       //Get the selected TabId
       int iProfileTabId = Convert.ToInt32(Settings["TabID"]);

       //Redirect to selected Page
        this.Response.Redirect(Globals.NavigateURL(iProfileTabId), true);



DotNetNuke 7.3 Hosting with ASPHostPortal.com :: Creating a DotNetNuke (DNN) module with an .ascx control

clock Desember 1, 2014 05:52 by author Dan

Today, we will discuss about Create a DotNetNuke (DNN) module with an .ascx control. Without the utilization of the visual studio templated of the Dotnetnuke starterkit.

Installed on the PC :

  • Visual Studio 2008 Express
  • IIS 5.1
  • Dotnetnuke
  • SQL Server 2008 R2

Dotnetnuke is arranged and acting as the default site as http:\\localhost. I utilize XP Pro IIS administrator to switch between sites.

Create a visual studio project

  • Create an C# ASP.NET Web application project
    The location of the project can be inside the DotNetNuke folder in the \DesktopModules folder. I have used “TestProject”.
  • The output of the project can be directed into the bin folder of the DotNetNuke folder. You can enter ‘..\..\bin’ as the output path in the build tab of the project properties
  • Add a reference to the DotNetNuke.dll (located in the \bin folder)
  • Add a new Web User Control (.ascx) file to your project (e.g. WebUserControlTest.ascx)
  • In the code behind of the new control, use the DotNetNuke namespaceusing DotNetNuke.Entities.Modules;
  • Inherit your control from DotNetNuke’s PortalModuleBase class. In the class created by visual studio you can replace ‘System.Web.UI.UserControl’ by ‘PortalModuleBase’. It will look like this:public partial class WebUserControlTest: PortalModuleBase
  • Implement some sample code inside the control.
    For example, add a literal component to the control, and set the Text in the ‘Page_Load’ function of the code behind.
    The .ascx file looks like this:
    <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="WebUserControlTest.ascx.cs" Inherits="SecondTest.WebUserControlTest" %>
    <asp:Literal ID="PageHeaderText" runat="server" />The .ascx.cs file looks like this:using System;
    using System.Collections.Generic;
    using System.Linq;using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using DotNetNuke.Entities.Modules;

    namespace TestProject
    {
    public partial class WebUserControlTest : PortalModuleBase
    {
    protected void Page_Load(object sender, EventArgs e)
    {
    if (this.Page.IsPostBack == false)
    {
    this.PageHeaderText.Text = "Hallo DotNetNuke world!!!";
    }
    }
    }
    }
  • Build the user control project. A DLL called ‘TestProject.dll’ will be created in the \bin folder

Notes: The web control can't contain a Form. Since Dotnetnuke as of now has structure on its parent .aspx page. Asp.net can just have one structure for every page. In this way, how about we utilize Panels, Views or Multiviews in your web control.

Create a module definition in DotNetNuke

  • Login in with a SuperUser account (host)
  • On the host page, go to module definitions
  • If you are in Edit mode, you’ll find an option ‘create new module’ at the bottom of the page.
  • For ‘Create module from”, select ‘control’ (I guess….)
  • Then in the module folder, select the folder you made for your project. I looks like DNN scans for folder in the DesktopModules folder. In this example it is ‘TestProject’.
  • When the module folder is chosen, the resource if filled in by DNN: WebUserControlTest.ascx
  • Enter a module name: E.g. ‘TestModule’
  • Enable the creating of a test page if you want.
  • Click on ‘create module’ and DNN updates it’s administraion and create a page with our new module already inside it. You need to see the text “Hallo DotNetNuke world!!!” on the page.

If there should arise an occurrence of issues. Check the security settings inside IIS. Permit script to run in the home direcorty. Furthermore let the new organizer of the venture be adjusted by the Asp.net machine account and the web visitor account (in the event that you need to test if from an alternate machine in your LAN).

Debug your control

  • In the Web settings of the project, set http://localhost/ as the Start Url.
  • Enable the use of the local IIS server and configure the following:
  • project url: http://localhost/DesktopModules/TestProject
  • Override appliucation root URL: http://localhost/
  • Go to the C# code behind of the control and set a break point at the line where we set the Text of the literal.
  • Start debugging (press F5)
  • A browser will be started, and the DotNetNuke start page is loaded.
  • Navigate to the test page of the ‘TestProject’ module. Maybe you have to login for this.
  • At the moment, the test page is loaded, visual studio express will become active and display the location where it has stopped. Now you can step through the code of your control.

You' can get an error message that your framework can't begin debugging on the web server. It likewise says you have to empower incorporated Windows verification for that. I replicated the data how to do that:

To enable integrated Windows authentication

  • Click Start and then click Control Panel.
  • In Control Panel, double-click Administrative Tools.
  • Double-click Internet Information Services.
  • Click the DotNetNuke Web server node.A Web Sites folder opens underneath the server name.
  • You can configure authentication for all Web sites or for individual Web sites. To configure authentication for all Web sites, right-click the Web Sites folder and then click Properties. To configure authentication for an individual Web site, open the Web Sites folder, right-click the individual Web site, and then click Properties.The Properties dialog box is displayed.
  • Click the Directory Security tab.
  • In the Anonymous access and authentication control section, click Edit.The Authentication Methods dialog box is displayed.
  • Under Authenticated access, select Integrated Windows authentication.
  • Click OK to close the Authentication Methods dialog box.
  • Click OK to close the Properties dialog box.
  • Close the Internet Information Services window.


DotNetNuke 7.3 Hosting with ASPHostPortal.com :: How to Resolve the Registered Script Control Error in DotNetNuke 7

clock November 28, 2014 05:14 by author Mark

Registered Script Control Error in DotNetNuke 7

If you’ve made the transition from DotNetNuke 6 to DotNetNuke 7 you’ve probably discovered that the AJAX Toolkit controls don’t play nice with DotNetNuke any more.  Fortunately the Telerik AJAX controls have been bundled with DotNetNuke for version 7.  I’ve discovered that converting to the Telerik controls has been beneficial and worth the upgrade.
Still, it can be a pain getting the code right.  One particular error that I ran into today was the Registered Script Control error.  It looks something like this:

"Script control ‘{controlname}’ is not a registered script control. Script controls must be registered using RegisterScriptControl() before calling RegisterScriptDescriptors().  Parameter name: scriptControl"

The error results from “stacked” AJAX controls.  Consider the following HTML

<%@ Register TagPrefix=”dnnui” Namespace=”DotNetNuke.Web.UI.WebControls” Assembly=”DotNetNuke.Web” %>
<%@ Register TagPrefix=”DNN” Namespace=”DotNetNuke.UI.WebControls” Assembly=”DotNetNuke.WebControls” %>
   <DNN:DNNTabStrip ID=”tabsProject” runat=”server” TabRenderMode=”All” Visible=”true”>
     <DNN:DNNTab runat=”server” Label-Text=”Properties” ID=”tabGeneral”>
       <dnnui:DnnAjaxPanel runat=”server” ID=”dapMain”>
         <asp:Label runat=”server” ID=”lblInfo”></asp:Label>
       </dnnui:DnnAjaxPanel>
   </DNN:DNNTab>
     <DNN:DNNTab runat=”server” Label-Text=”Properties” ID=”tabSecond”>
       <dnnui:DnnAjaxPanel runat=”server” ID=”dapSecond”>
         <asp:Label runat=”server” ID=”lblMessage”></asp:Label>
       </dnnui:DnnAjaxPanel>
   </DNN:DNNTab>
      </DNN:DNNTabStrip>

Let’s say that the second tab (tabSecond) should only appear under certain conditions; a record was created, a particular user is logged, whatever the condition is doesn’t matter, just that the tab should appear at certain times and not appear at other times.
In the code behind the condition block might look like this:

if (condition) then
tabSecond.Visible = False
end if

But this results in the Registered Script Control error.  Modify the condition block this way:

if (condition) then
dapSecond.EnableAJAX = False
tabSecond.Visible = False
end if

This should resolve the error

What was the issue?  I’m glad you asked.
The issue causing the error is that AJAX controls are registered with the AJAX script manager and cannot be unregistered, or moved.  Hiding an AJAX control is equivalent to moving it from the script.  In order to circumvent that we’re disabling AJAX on the control before it has a chance to be rendered and registered with the script manager.



DotNetNuke 7.3 Hosting with ASPHostPortal.com :: How to Programmatically Create Portals in DNN

clock November 24, 2014 06:31 by author Dan

Introduction

DotNetNuke's portal system is one of its most compelling features. DNN Portals can be either Parent or Child. The different is from the url.

Parent Portal (example):

http://www.asphostportal.com
http://dnn.asphostportal.com

Child Portal (example):

http://www.asphostportal.com
http://asphostportal.com/dnn (As we have utilized "/" after area name, its called child portal)

Sometimes we have to create custom modules where we have to programmatically create portals. In this article we will plot how to make a a child portal programmatically. The technique needs few parameters to be passed which will be obliged to make the child portal. All these parameters have some settled reason. The part of individual parameters are unmistakably clarified in this technique.

/// <summary>
/// Creates new child portal
/// </summary>
protected void CreateNewPortal(string strPortalName, string strPassword, string strConfirmPassword,
 string strFirstName, string strLastName, string strUserName,
 string strQuestion, string strAnswer, string strEmail)
{
 
try
{
PortalController.PortalTemplateInfo template = LoadPortalTemplateInfoForSelectedItem();
 
bool blnChild;
string strPortalAlias;
string strChildPath = string.Empty;
var closePopUpStr = string.Empty;
 
var objPortalController = new PortalController();
 
//Set Portal Name
strPortalName = strPortalName.ToLowerInvariant();
strPortalName  = strPortalName.Text.Replace("http://", "");
 
//Validate Portal Name
if (!Globals.IsHostTab(PortalSettings.ActiveTab.TabID))
{
blnChild = true;
strPortalAlias = strPortalName;
}
else
{
blnChild = true;
 
strPortalAlias = blnChild ? strPortalName.Substring(strPortalName.LastIndexOf("/") + 1) : strPortalName;
}
 
string message = String.Empty;
ModuleMessage.ModuleMessageType messageType = ModuleMessage.ModuleMessageType.RedError;
if (!PortalAliasController.ValidateAlias(strPortalAlias, blnChild))
{
message = Localization.GetString("InvalidName", LocalResourceFile);
}
 
//Validate Password
if (strPassword != strConfirmPassword)
{
if (!String.IsNullOrEmpty(message)) message += "<br/>";
message += Localization.GetString("InvalidPassword", LocalResourceFile);
}
string strServerPath = Globals.GetAbsoluteServerPath(Request);
 
//Set Portal Alias for Child Portals
if (String.IsNullOrEmpty(message))
{
if (blnChild)
{
strChildPath = strServerPath + strPortalAlias;
 
if (Directory.Exists(strChildPath))
{
message = Localization.GetString("ChildExists", LocalResourceFile);
}
else
{
if (!Globals.IsHostTab(PortalSettings.ActiveTab.TabID))
{
strPortalAlias = Globals.GetDomainName(Request, true) + "/" + strPortalAlias;
}
else
{
strPortalAlias = strPortalName;
}
}
}
}
 
//Get Home Directory
string homeDir = "";
 
//Validate Home Folder
if (!string.IsNullOrEmpty(homeDir))
{
if (string.IsNullOrEmpty(String.Format("{0}\\{1}\\", Globals.ApplicationMapPath, homeDir).Replace("/", "\\")))
{
message = Localization.GetString("InvalidHomeFolder", LocalResourceFile);
}
if (homeDir.Contains("admin") || homeDir.Contains("DesktopModules") || homeDir.ToLowerInvariant() == "portals/")
{
message = Localization.GetString("InvalidHomeFolder", LocalResourceFile);
}
}
 
//Validate Portal Alias
if (!string.IsNullOrEmpty(strPortalAlias))
{
PortalAliasInfo portalAlias = PortalAliasController.GetPortalAliasLookup(strPortalAlias.ToLower());
if (portalAlias != null)
{
message = Localization.GetString("DuplicatePortalAlias", LocalResourceFile);
}
}
 
//Create Portal
if (String.IsNullOrEmpty(message))
{
//Attempt to create the portal
var objAdminUser = new UserInfo();
int intPortalId;
try
{
                            // These parameters are required to assign admin to the portal
objAdminUser.FirstName = strFirstName;
objAdminUser.LastName = strLastName;
objAdminUser.Username = strUsername;
objAdminUser.DisplayName = strFirstName + " " + strLastName;
objAdminUser.Email = strEmail;
objAdminUser.IsSuperUser = false;
 
objAdminUser.Membership.Approved = true;
objAdminUser.Membership.Password = strPassword;
objAdminUser.Membership.PasswordQuestion = strQuestion;
objAdminUser.Membership.PasswordAnswer = strAnswer;
 
objAdminUser.Profile.FirstName = strFirstName;
objAdminUser.Profile.LastName = strLastName;
 
intPortalId = objPortalController.CreatePortal(tbTitle.Text,
objAdminUser,
tbDescription.Text,
"",
template,
homeDir,
strPortalAlias,
strServerPath,
strChildPath,
blnChild);
 
//Clears the cache
DotNetNuke.Common.Utilities.DataCache.ClearPortalCache(PortalId, false);
}
catch (Exception ex)
{
intPortalId = Null.NullInteger;
message = ex.Message;
}
                        // Sends email on portal creation
SendMailOnPortalCreation(intPortalID, strEmail, strPortalAlias, objAdminUser);
}
 
DotNetNuke.UI.Skins.Skin.AddModuleMessage(this, "", message, messageType);
 
}
catch (Exception exc) //Module failed to load
{
Exceptions.ProcessModuleLoadException(this, exc);
}
}

The motivation behind this technique to send email on effective creation of child portal. The sending of email obliges legitimate SMTP settings in the DNN site.

private void SendMailOnPortalCreation(int intPortalID, string strEmail, string strPortalAlias, UserInfo objAdminUser)
{
try
{
if (intPortalId != -1)
{
//Create a Portal Settings object for the new Portal
PortalInfo objPortal = objPortalController.GetPortal(intPortalId);
var newSettings = new PortalSettings { PortalAlias = new PortalAliasInfo { HTTPAlias = strPortalAlias }, PortalId = intPortalId, DefaultLanguage = objPortal.DefaultLanguage };
string webUrl = Globals.AddHTTP(strPortalAlias);
try
{
if (!Globals.IsHostTab(PortalSettings.ActiveTab.TabID))
{
message = Mail.SendMail(PortalSettings.Email,
strEmail,
PortalSettings.Email + ";" + Host.HostEmail,
Localization.GetSystemMessage(newSettings, "EMAIL_PORTAL_SIGNUP_SUBJECT", objAdminUser),
Localization.GetSystemMessage(newSettings, "EMAIL_PORTAL_SIGNUP_BODY", objAdminUser),
"",
"",
"",
"",
"",
"");
}
else
{
message = Mail.SendMail(Host.HostEmail,
strEmail,
Host.HostEmail,
Localization.GetSystemMessage(newSettings, "EMAIL_PORTAL_SIGNUP_SUBJECT", objAdminUser),
Localization.GetSystemMessage(newSettings, "EMAIL_PORTAL_SIGNUP_BODY", objAdminUser),
"",
"",
"",
"",
"",
"");
}
}
catch (Exception exc)
{
Exceptions.ProcessModuleLoadException(this, exc);
 
closePopUpStr = (PortalSettings.EnablePopUps) ? "onclick=\"return " + UrlUtils.ClosePopUp(true, webUrl, true) + "\"" : "";
message = string.Format(Localization.GetString("UnknownSendMail.Error", LocalResourceFile), webUrl, closePopUpStr);
}
var objEventLog = new EventLogController();
objEventLog.AddLog(objPortalController.GetPortal(intPortalId), PortalSettings, UserId, "", EventLogController.EventLogType.PORTAL_CREATED);
 
//Redirect to this new site
if (message == Null.NullString)
{
 
//webUrl = (PortalSettings.EnablePopUps) ? UrlUtils.ClosePopUp(true, webUrl, false) : webUrl;
Response.Redirect(webUrl, true);
}
else
{
closePopUpStr = (PortalSettings.EnablePopUps) ? "onclick=\"return " + UrlUtils.ClosePopUp(true, webUrl, true) + "\"" : "";
message = string.Format(Localization.GetString("SendMail.Error", LocalResourceFile), message, webUrl, closePopUpStr);
messageType = ModuleMessage.ModuleMessageType.YellowWarning;
}
}
}
catch (Exception exc) //Module failed to load
{
Exceptions.ProcessModuleLoadException(this, exc);
}
}

Conclusion:

By utilizing the above procedure simply make the child portals in DNN. Assuredly, this post describes the procedure clearly and and useful for you



DotNetNuke 7.3 Hosting with ASPHostPortal.com :: Developing a Webservice in DotNetNuke 7.3

clock November 21, 2014 05:30 by author Ben

I have recently been assigned to built a DotNetNuke web service to permit a windows application (or any sort of net client for instance) the flexibility to control DotNetNuke person accounts (create, change roles, delete, retrieve e mail address, and so forth.).

 


Since I had a tough time locating an accurate code sample or documentation that really applies to DotNetNuke 7.3 and accessing it without having being earlier logged in to DotNetNuke, it absolutely was difficult to constructed anything at all. I ultimately found out how to do it properly so I hard I would put my attempts to some use and write a blog publish explaining how you can get it done step by stage.

That said, let's begin by the fundamentals and just create a publicly available web services that permits anybody to ping the net service and acquire a pong again. For that we are going to use the new DotNetNuke 7 Providers Framework which makes it fairly simple should you know how to utilize it.

In order to create a net support that will work within DotNetNuke 7, you will need to fireplace up Visual Studio and create a class Library project (c# or VB but all illustrations listed here will be in c#).

That done, we will then reference some needed DotNetNuke 7 required libraries (making use of the Add Reference dialog box), here's the list:

DotNetNuke.dll
DotNetNuke.Web.dll
System.Net.Http.dll
System.Net.Http.Formatting.dll
System.Web.Http.dll

Then we also need to reference the System.Web class from the .NET tab of the same dialog box.

Finally, we neet to set the output path of the project to the DotNetNuke bin directory and we are ready to code.

Here is the code, the explanations follow:

using System.Net;
using System.Net.Http;
using System.Web.Http;
using DotNetNuke.Web.Api;
 
namespace MyService
{
    public class PingController : DnnApiController
    {
        [AllowAnonymous]
        [HttpGet]
        public HttpResponseMessage PublicPing()
        {
            return Request.CreateResponse(HttpStatusCode.OK, "Pong!");
        }
    }
 
    public class RouteMapper : IServiceRouteMapper
    {
        public void RegisterRoutes(IMapRoute mapRouteManager)
        {
            mapRouteManager.MapHttpRoute("MyService", "default", "{controller}/{action}", new[]{"MyService"});
        }
    }
}

  1. We merely start with some using statements for our needs as demonstrated previously mentioned
  2. We develop a namespace for our service and no matter what name we use listed here will be part of the url. I utilized MyService just for this instance but use any name which makes perception for your services.
  3. Now we create a public class for our controller. You'll be able to create numerous controllers if you want to and the controller is just a bunch of related actions that make feeling to group with each other. In my genuine project I have a PingController for testing functions, a UsersController for almost any steps that relate to user accounts and so forth. Just utilize a identify that makes feeling because it will even present up in the url. Two things for being careful right here:

    • The identify of one's controller should end using the term Controller but only what will come just before it will show inside the url, so for PingController, only Ping will show in the url route.
    • It should inherit DnnApiController so it'll use the DotNetNuke Providers Framework.
  4. Then we create the actual motion, inside our case, PublicPing. It's just a straightforward technique which return an HttpResponseMessage and may have a handful of characteristics. By default the brand new providers framework will respond only to host consumers and you also must explicitly enable other access rights if necessary, in this case the [AllowAnonymous] helps make this technique (or action if you prefer) obtainable to anyone with out credentials. The next attribute, [HttpGet] can make this action reply to HTTP GET verb, which can be usually used when requesting some date in the web server.
  5. Finally in that action, you insert whatever code you action needs to do, in this case just return the string "Pong!", just remember that you should return an HttpResponseMessage rather than a string or int or other item.

Ok so our controller and motion is done, now we just need to map that to an actual URL and that exactly what the final portion of the earlier code does. In essence this code tells DotNetNuke to map a specific url pattern for the techniques outlined in your course. You can use that code as is simply replacing MyService by no matter what your support title is.

Testing:
That is all there is certainly to it, your services is prepared! To test it, first compile it, then just navigate to http://yourdomain/DesktopModules/MyService/API/Ping/PublicPing and you should see "Pong!" inside your browser like a response.

Passing parameters

Ok, so the basic code above is working but it doesn't do anything useful. Lets add something more useful by creating an action that will give us the email address for a specific user id.

Again, here's the code and the explanations will follow (place the code inside the same namespace as the previous one):

public class UsersController : DnnApiController
    {
        [RequireHost]
        [HttpGet]
        public HttpResponseMessage GetEmail(int userid)
        {
            DotNetNuke.Entities.Users.UserInfo ui;
            ui = DotNetNuke.Entities.Users.UserController.GetUserById(PortalSettings.PortalId, userid);
            return Request.CreateResponse(HttpStatusCode.OK, ui.Email);
        }
    }


Initial we build a UsersController course which will hold all actions related to person accounts, it isn't completely required, you'll be able to have numerous steps within the same controller, nonetheless because this motion is not in any respect connected to our PingController, let'a create a new one more descriptive.

We then create a GetEmail motion (method) which will accept a userid parameter. The [RequireHost] parameter listed here will make it accessible only to host customers, we are going to see afterwards other authentication options.

The code inside the approach alone is fairly significantly self explanatory. The only interesting factor to notice listed here is the fact that because our course inherits DnnApiController, we already have a PortalSettings item obtainable. That is the big benefit of producing use of the DotNetNuke Solutions Framework. You'll have a ModuleInfo object to represent your module (if there is 1 using the identical identify as your support, which can be not essential such on this scenario), a PortalSettings object that signifies the portal at the domain title utilized to accessibility the support (portal alias) and at last a UserInfo item symbolizing the person that accessed the web services.

Testing:
If we now navigate to http://yourdomain/MyService/API/Users/GetEmail?userid=2 you need to receive the email tackle back again from the server unless of course obviously that userid does not exist, ensure that you check having a userid that truly exists for that portal. Should you exactly where not formerly linked having a host account, you then will probably be requested for qualifications.

Limiting access to particular roles

Alright, that actually works however, you need to give host qualifications to anyone needing to make use of your webservice. To avoid which you can change [RequireHost] by [DnnAuthorize(StaticRoles="Administrators")] which can limit access to administrators. Much better however, you nevertheless must provide them with an admin account. So the easy method to give only constrained entry would be to create a brand new role in DotNetNuke only for your internet services and substitute Administrators by that specific function title within the authentication parameter.

Utilizing HttpPost : (reply to a comment down bellow)

To answer Massod comment bellow, it's nearly exactly the same thing however, you have to develop an object to contain the posted information.

Let's make a easy ping that makes use of Submit, very first we need to create an object which will contain the posted info this sort of as:

public class FormMessage
    {
        public string Message { get; set; }
    }

Then we create the service method something like this:


public class PingController : DnnApiController
   {
       [AllowAnonymous]
       [HttpPost]
       public HttpResponseMessage PostPing(FormMessage formMessage)
       {
           return Request.CreateResponse(HttpStatusCode.OK, "Pong from POST: message was '" + formMessage.Message + "'.");
       }
   }

note that normally, a post would only return ok and no message, I am just doing this so we can test here.

Now since this is a POST verb, we can't test it by only using url parameters, we need to make an html file with a form to test it out. It would be someting like this:

http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>Untitled Pagetitle>
head>
<body>
    <form action="http://dnndev/DesktopModules/MyService/API/Ping/PostPing" method="POST">
        <label for="message">Message: label><input type="text" name="Message"/>
        <input type="submit" value="Submit"/>
    form>
body>
html>

The crucial thing to not right here is you can not just develop your Publish technique taking a string even when this can be only what you require, you do must create an object which will get your parameters.

Also never overlook that this is only for tests, you usually do not need to make this publicly accessible, you'd probably usually use yet another parameter than [AllowAnonymous] such as [DnnModuleAuthorize(AccessLevel = SecurityAccessLevel.View)] and [ValidateAntiForgeryToken] unless you truly want that for being public.

 



DotNetNuke 7.3 Hosting with ASPHostPortal.com :: Allow Non-Admins to do Web Page Management

clock November 19, 2014 07:14 by author Ben

In DotNetNuke 7.3 the artificial distinctions between Normal and Admin webpages was taken out. All Modules confirmed inside the Admin-Menu can now even be placed on any custom webpage and fundamentally everyone could use them. This informative article gives you directions how you can permit Non-Admins to access the DNN Web page Management and workaround some restrictions.

 


Erik Van Ballegoij presently wrote regarding how to offer non admins accessibility to any admin web page. You can just insert the module like any other into a preferred Page. It’s important to give the desired user(s) Edit Permission on that Web page (not only on that module) otherwise they get an “Access Denied” warning.

Essentially which is it. Users can now edit Page options for Web pages they have edit Permissions to but for no other Pages. There are just two limitations:

  1. Drag and fall to reorder Pages only functions for Directors
  2. Incorporate Webpage(s) only operates for Directors


To get these functionality to operate for Non-Administrators adapt the file at ~/DesktopModules/Admin/Tabs/Tabs.ascx.cs. You’d need to comment out a Safety examine PortalSecurity.IsInRole(PortalSettings.AdministratorRoleName) three times:\

  1. OnInit: remark out the if-Condition (line ~237) and the else statement (~243-247)
  2. CtlPagesNodeDrop: comment out the if-Condition (very first line)
  3. OnCreatePagesClick: remark out the if-Statement (first two strains)


Which is it. I examined it effectively on DNN 7.3.3.

 

 



DotNetNuke 7.3 Hosting :: How to put PayPal Buy Now buttons in your DotNetNuke Portal

clock November 17, 2014 06:52 by author Dan

DotNetNuke is a web content management system based on Microsoft .NET. The Community Edition is open source. But today, we will not describe more detail about DotNetNuke. We will explain to you the simple trick  to put PayPal Buy Now buttons in your DotNetNuke Portal. This is important for your online store because this button will help your customers to buy your product. Now, please read this simple trick carefully. Here is the step :

Remove the <Form> </Form> tags from your PayPal “Buy Now” code.

Add
onClick=”this.form.action=’https://www.paypal.com/dnn-bin/webscr&#8217;;
this.form.submit();”

to the buy now input button.

Paste what is left into the html module

What it does is change the action for the Form that is already embedded into the DotNetNuke default.aspx page.

Here is an an example:

<input type=”hidden” name=”cmd” value=”_xclick”>
<input type=”hidden” name=”business” value=”[email protected]”>
<input type=”hidden” name=”item_name” value=”Send us some money”>
<input type=”hidden” name=”item_number” value=”Gift”>
<input type=”hidden” name=”amount” value=”100.00″>
<input type=”hidden” name=”no_shipping” value=”2″>
<input type=”hidden” name=”no_note” value=”1″>
<input type=”hidden” name=”currency_code” value=”USD”>
<input type=”hidden” name=”lc” value=”US”>
<input type=”hidden” name=”bn” value=”PP-BuyNowBF”>
<input type=”image”
onClick=”this.form.action=’https://www.paypal.com/dnn-bin/webscr&#8217;;this.form.submit();”

src=”https://www.paypal.com/en_US/i/btn/x-click-but23.gif&#8221; border=”0″ name=”submit” alt=”Make payments with PayPal – it’s fast, free and secure!”>
<img alt=”” border=”0″ src=”https://www.paypal.com/en_US/i/scr/pixel.gif&#8221; width=”1″ height=”1″>

Finish, Your Paypal Buy Now Button is ready to use.



DotNetNuke 7.3 Hosting | How to configure SMTP authentication in DotNetNuke(DNN) to send email

clock November 13, 2014 04:36 by author Dan

SMTP Authentication, regularly shortened SMTP AUTH, is an extension of the Simple Mail Transfer Protocol whereby a SMTP customer may log in utilizing a verification system picked among those supported by the SMTP server. The authentication extensionion is required for conformation servers. Today, we will discuss about "How to configure SMTP authentication in DotNetNuke(DNN) to send email". To configure SMTP authentication in DotNetNuke(DNN) to send email, you need to set smtp authentication in DotNetNuke(DNN) site to send email, please follow the instructions below to set it.

>> Login to DNN site as Host User

>> Click 'Host' --> 'Host settings' --> 'Advanced settings'

>> On the page, expand  'SMTP Server Settings'

>> Important! "Host Email" field under "Host Details"-->"Basic setting" section in host settings menu must be modified to the Email address correspond to you SMTP username.



DotNetNuke 7.3 Hosting with ASPHostPortal.com :: New Google Maps Integration with DotNetNuke 7.3

clock November 11, 2014 05:23 by author Ben

Now you'll be able to add Google maps to posts. Post might have the primary post map, and with tokens you'll be able to include a limiteless quantity of maps to content articles. Maps may be very easily created and edited by way of the in-built Map editor.

Within this blog I'll clarify How you can insert new google maps into DotNetNuke 7.3. Google has up-to-date Google maps to new UI and features.

So will start with Google maps very first.

Click the Google applications on right top facet of one's browser. Open up Google maps appplication.

You will be landed to New Google maps. Type your address or location in the search box. For instance i have added Madame Tussaud Newyork.

Once your location is targeted on google maps.Click on setting at the right bottom side of the map and select share and embed maps.

A modal popup will look on the display with Share hyperlink and Embed map alternative. By this you are able to possess the link in the map to provide to any hyperlinks if required else we can select to embed the map into your site or application. Also you'll be able to shorten the URL if necessary .

Given that we need to embed google maps into DNN we are going to choose Embed maps alternative. After you click on embed maps option you'll have a smaller sized see of maps you've selected i.e in my scenario Madame Tussauds The big apple with ratings, reviews, bigger map choice and obtain directions. You can even bookmark if necessary.

OK once you have got map on Embed maps. Now you can choose the size of the map required based on your requirement. Google offers small, medium, large and custom size.

We can change the size of the maps by using custom size.Google maps also provides option to preview your custom size by clicking on preview option.A new window will be popped out for preview.

For now we will be using Medium as our map size. Will select medium size and copy the iframe provided.

Once iframe is copied will now login to our DNN (DotnetNuke). Add username and password and login to DNN.

Once DNN is logged in. To place our Google maps on our site we need to add a HTML module to our site. This can be added  by navigating to Modules > Add New Module > Selecting Common from the Drop down.

Once common option is selected from drop down options will be narrowed to HTML. Drag the HTML module to your selected pane in my case i am adding module to Content Panel.

Now we have added HTML module to our Content panel. We need to edit content inside our HTML module. This can be completed by clicking on pencil icon existing on the HTML module. In the event you dont have pencil icon navigate to Edit page choice on proper leading corner in the DNN control panel. After pencil icon is clicked click on on edit content.

Once you select Edit Content. A modal popup will appear with all editing option. Initally the editr will be in Design mode change the mode to HTML. This can done just by clicking on HTML option just below the editor.

Once you selected HTML mode. Paste the iframe we copied from Google maps to the HTML editor in DNN. After pasting the iframe to DNN editor save the module by clicking on save button.

Thats it Google maps will be embeded on your DNN page in a following way.

Hope you liked my tutorial.

 



About ASPHostPortal.com

We’re a company that works differently to most. Value is what we output and help our customers achieve, not how much money we put in the bank. It’s not because we are altruistic. It’s based on an even simpler principle. "Do good things, and good things will come to you".

Success for us is something that is continually experienced, not something that is reached. For us it is all about the experience – more than the journey. Life is a continual experience. We see the Internet as being an incredible amplifier to the experience of life for all of us. It can help humanity come together to explode in knowledge exploration and discussion. It is continual enlightenment of new ideas, experiences, and passions

Author Link


 photo ahp banner aspnet-01_zps87l92lcl.png

Corporate Address (Location)

ASPHostPortal
170 W 56th Street, Suite 121
New York, NY 10019
United States

Tag cloud

Sign in