DotNetNuke Hosting with

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

DotNetNuke 7.3 Hosting with :: 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:


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
        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.

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
        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.

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
       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:">
<html xmlns="" >
    <title>Untitled Pagetitle>
    <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"/>

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 :: 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 with :: TIPS Getting rid of spam users

clock November 18, 2014 06:14 by author Mark

Quick tips : Getting rid of spam users

After getting a couple of questions, I'd like to provide options for getting rid of spam users, which is cumbersome via UI, if thousands of registration have been added by a bot.
Unfortunately, it is not as easy as just deleting items from a single table, as user Information is distributed in multiple tables inside the database, therefore we need.
You are in a comfortable situation, if your site is using verified or private registration - in this case all spam users are unauthorized and you simply need to hit "delete unauthorized users" in Admin > User Accounts.
In all other cases, you will need to identify the users to delete from the database and mark as "deleted", in order to use "remove deleted users" (hard-delete) those users from all tables.


If your site only has a host and admin user you would run the following statement inside Host > SQL (check "run as script" in all DNN versions prior to 7.3):
UPDATE {databaseOwner}[{objectQualifier}UserPortals]
 SET   isDeleted = 1
 WHERE UserID NOT IN (SELECT UserID FROM  {databaseOwner}[{objectQualifier}Users
                                    WHERE isSuperuser = 1 OR UserName Like 'Admin')
If you may identify all users by registration date, e.g. since first of November, you would run
UPDATE {databaseOwner}[{objectQualifier}UserPortals]
 SET   isDeleted = 1
 WHERE UserID NOT IN (SELECT UserID FROM  {databaseOwner}[{objectQualifier}Users]
                                    WHERE isSuperuser = 1 OR UserName Like 'Admin' or CreatedOnDate < 2014-18-11)

Of course, this will become more difficult, if regular users registered the same time. You may consider creating a role "verifiedUsers" and move all regular users manually into this group. Now the command would look like

UPDATE {databaseOwner}[{objectQualifier}UserPortals]
 SET   isDeleted = 1
 WHERE UserID NOT IN (SELECT UserID FROM  {databaseOwner}[{objectQualifier}Users]
                                    WHERE isSuperuser = 1 OR UserName Like 'Admin' or CreatedOnDate < 2014-18-11)
   AND UserID NOT IN (SELECT UserID FROM {databaseOwner}[{objectQualifier}vw_UserRoles]
                                    WHERE RoleName Like 'verifiedUsers')

Afterwards you may use "Remove Deleted Users" link in Admin > User Management, to delete all rows.
For DNN Versions prior to DNN 7.3.1, you need to delete user folders manually, which reside nested inside users subfolder of the portal folder. Unfortunately, it is difficult to identify all folders from deleted users, but you may delete all empty folders without subfolder and files inside, as the folder for a still existing user will be re-created, once the user logs in again for the first time. You may use the following command (sing a command line on the server, while being inside the users folder)
for /f "delims=" %i in ('dir /ad /s /b') do @rd "%i"
Finally, you should enter file manager in DNN Admin menu and perform a recursive sync to get rid of all folder entries and folder permissions in the database

DotNetNuke 7.3 Hosting with How to Reset DotNetNuke 7.3 Password

clock September 2, 2014 08:26 by author Ben

Best and Cheap DotNetNuke 7.3 Hosting

DNN 7.3 has been released and contains lots of changes for performance and stability, bug fixes and some new features. The DNN 7.3 release improves the run-time characteristics of the platform in a variety of ways. End users will notice faster page response time and administrators will appreciate a more responsive user experience, especially on larger scale web sites. Server processing has been optimized and resource consumption has been dramatically reduced, resulting in greater scalability and improved site density in all infrastructure environments.

New Features of DotNetNuke 7.3 Hosting

DotNetNuke 7.3 includes a number of new features and enhancements that will benefit users and developers alike along with a large number of bug fixes. Here is the new features of DNN 7.3:

Platform performance enhancements
dnnPanels enhancements
HTML 5 tags as skin panes
Added support for Google Analytics tracking code to support Display Advertising
Save/Restore Module with Settings/Content

How to Reset DNN 7.3 Password

You can use the below steps to reset the DNN 7.3 password :

1. Open SQL Query Analyzer – Connect to your dotNetNuke database.

2. Paste the following Stored Procedure code into the window,

ALTER procedure [dbo].[uap_ResetPassword]
@UserName NVarChar(255),
@NewPassword NVarChar(255)
Declare @PasswordSalt NVarChar(128)
Declare @ApplicationID NVarChar(255)
Declare @ApplicationName NVarChar(255)
Set @ApplicationID = (SELECT [ApplicationID] FROM aspnet_Users WHERE [email protected])
Set @ApplicationName = (SELECT [ApplicationName] FROM aspnet_Applications WHERE [email protected])
Set @PasswordSalt = (SELECT PasswordSalt FROM aspnet_Membership WHERE UserID IN (SELECT UserID FROM aspnet_Users WHERE [email protected]))
–select @ApplicationID, @ApplicationName
declare @RetVal as int
Exec @RetVal = dbo.aspnet_Membership_ResetPassword @ApplicationName, @UserName, @NewPassword, 10, 10, @PasswordSalt, -5
return @RetVal

3. Now you can reset your DotNetNuke 7.3 passwords by simply opening up SQL Query Analyzer, connecting to your dotNetNuke database, then typing uap_ResetPassword ‘username’, ‘newpassword’.

Reason to Choose DotNetNuke 7.3 Hosting with is a windows-based hosting service provider. offers the most reliable and stable DotNetNuke 7.3 web hosting infrastructure on the net with great features, fast and secure servers. Our hosting can be done via USA, Amsterdams or Singapore based server. Depending your requirements, we can scale so we can deliver the right service for the right price. All of our windows hosting plan supports DotNetNuke 7.3 and you can install DotNetNuke 7.3 with just one click.


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

Corporate Address (Location)

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

Tag cloud

Sign in