DotNetNuke Hosting with ASPHostPortal.com

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

DotNetNuke Hosting - ASPHostPortal.com :: How To Compile DNN Module Using Visual Studio Starter Kit

clock February 23, 2017 04:50 by author Armend

The Visual Studio Starter Kit enables you to create a compiled DotNetNuke module that can be much more compact, more quickly, and hide your supply code from prying eyes. The subsequent instructions can get you started and well in your approach to creating compiled DotNetNuke Modules.

  1. Download the Starter Kit
  2. Open Visual Studio  and create a new project (File -> New Project)

  1. From the dialogue follow these steps

    • Select Web from the Installed Templates. I use of VB.Net, but they are available in C# too.
    • Pick DotNetNuke Compile Module from your Project Type list.
    • Enter your Module Name
    • Enter the path for your DotNetNuke installation. Your project will be installed within the current set up within the DesktopModules folder and also the dll will likely be place in the bin folder.
    • Click OK
  2. Visual Studio will load up the venture within the Solution Explorer and open the Documentation.html in the editor. You’re not however ready to set up the module so don’t keep to the DotNetNuke documentation but.
  3. In the Solution Explorer right click on My Project and select Open.

Within the Application tab delete the entry in Root Namespace except if this is your only module, otherwise you will not be sharing code with other modules. I have a undertaking that spans numerous modules and i want them all inside the identical identify space. So, I delete the basis Namespace entry to ensure that I am able to put within the appropriate namespace from the code driving. (Edit regarding Root Namespace; in C# you do not need to clear the namespace, but in VB.Net you are doing).

  1. Switch towards the Compile tab. Verify the Build output path and make sure its pointing towards the proper bin folder. Now simply click the Advance Compile Option on the button of the tab. Around the dialogue make certain the target framework is correct. You’ll see the environment on the base of the dialogue. At this point the dialogue will immediately near.
  2. Repeat step 4 (open the project properties) then go to step 8
  3. Switch to the References tab.  You should see a reference to DotNetNuke.Library version 0.0.0.0.  Remove it

Nonetheless around the References tab, now click the Add button. Inside the Add Reference dialogue switch to the Browse tab and navigate for the DotNetNuke set up bin folder. Choose the DotNetNuke.dll, DotNetNuke.Web.dll, as well as the Telerik.Web.UI.dll. Should you do not hold the Telerik.Web.UI.dll then you definitely should not be making use of those controls and you also will not want the dll. Click Okay. These references are necessary to obtain access to the DotNetNuke methods and properties. In any other case you are code powering will be crammed with inexperienced and blue underlines, missing references, and, oh yeah, it won’t compile. Sort of defeats the aim, proper?

  1. Intellisense; this step is optional, but if you want Intellisense you’ll want to do this.  Switch to the Web tab. Under Servers select the “Use Local IIS Web server” option.  Change the Project URL to the full URL of your project (eg http://{domain}/DesktopModules/{project folder}).  Check “Override application root URL” and set it to the domain of your DotNetNuke install (eg http://{domain})
  2. Save the Project Properties and close it.
  3. Inside the Solution Explorer increase the Components folder and open up the ModuleNameController.vb (or .cs) file. Check the Namespace declaration and you’ll see that it states “YourCompany”. Change this to your customized namespace identifier and after that do the identical in each of the code powering documents. You will also need to change it inside the .ascx files because they’ll be reference the namespace inside the handle declaration at the best of the webpage.
  4. At this point you can Build your project and you will see the new dll in your DotNetNuke install bin folder.
  5. Now follow the instructions in the documentation.html to install the module in DotNetNuke.  Once the module is installed you don’t really need the documentation folder, or it’s files.  I usually delete it.

Best DotNetNuke Hosting Recommendation

ASPHostPortal.com
ASPHostPortal.com provides its customers with Plesk Panel, one of the most popular and stable control panels for Windows hosting, as free. You could also see the latest .NET framework, a crazy amount of functionality as well as Large disk space, bandwidth, MSSQL databases and more. All those give people the convenience to build up a powerful site in Windows server. ASPHostPortal.com offers DotNetNuke hosting starts from $5/month only. We also guarantees 30 days money back and guarantee 99.9% uptime. If you need a reliable affordable DotNetNuke Hosting, we should be your best choice.



DotNetNuke Hosting - ASPHostPortal.com :: How To Manage Pages in DNN

clock February 16, 2017 05:05 by author Armend

To create a new page in DNN is pretty simple. After you login on the site, look for the menu Pages and hover your mouse into the menu, a sub menu will appear under the menu. Click the option Add New Page.

A pop up window will appear like below.

Page Properties in DNN

Below is the main properties that you will basically utilize in daily use.

  • Page Name : Page name must unique and can not be duplicate or has the same name with other pages. What ever you type in here, it will appear exactly in the site menu.
  • Page Title : Page Title is used for meta tag Title. You can optimize your site by specifying individual unique title for each page.
  • Page URL : You can define your own custom url in here. This will help optimize your site for SEO purposes.
  • Description : This will be used in meta tag description. You can include a brief description about this page.
  • Keywords : This will be used in meta tag keyword. You can separate a keyword by comma. Note: most search engine will no longer consider the meta keyword as important factor for search engine search.
  • Include in Menu : By untick this one, the menu will be hidden and will not be visible in the site menu.

Manage Page's Permission

Each page has its own permission. If you see below picture,


The page permission will list available roles in the current site portal. By default Administrators, All Users, Registered Users, Subscribers, Translators, Unauthenticated Users, and Unverified Users are predefined in DNN. What we interest most are probably All Users which cover all user roles, Registered Users which cover registered members only and Administrators which covers admin account only. If you want to make the site visible to all users then you should tick All Users View Option. The Edit option, give ability to specific role to edit the content of the page. The content in here are the modules of the page, it could be HTML modules, news modules etc. If you do not want any public users able to view this page, you can set to Registered Users. But if you want to give the page visibility to admin only, then you should choose Administrators.


Alternatively, you can use Page Managements to manage your site pages easily. This menu is available under the Site menu. Please see below screenshot.

 

All your pages will be displayed in a tree menu on the left hand side. To edit the page, you can just click the menu name. If you want to delete the page, you can just simple right click the menu link.

Best DotNetNuke Hosting Recommendation

ASPHostPortal.com
ASPHostPortal.com provides its customers with Plesk Panel, one of the most popular and stable control panels for Windows hosting, as free. You could also see the latest .NET framework, a crazy amount of functionality as well as Large disk space, bandwidth, MSSQL databases and more. All those give people the convenience to build up a powerful site in Windows server. ASPHostPortal.com offers DotNetNuke hosting starts from $5/month only. We also guarantees 30 days money back and guarantee 99.9% uptime. If you need a reliable affordable DotNetNuke Hosting, we should be your best choice.

 



DotNetNuke Hosting - ASPHostPortal.com :: How To Search part of the DNN core

clock February 9, 2017 05:00 by author Armend

DNN Search is part of the DNN core that may be installed and configured out with the box.

 

DotNetNuke Search consists of four primary pieces:

  • Scheduled Job
    The scheduled process initiates the approach of indexing the modules, in the scheduled time interval. An iteration of all modules that support iSearchable is performed. Throughout this process, text that is extracted in the module is cleaned, parsed, and added to search word and search things tables.
  • Search Admin
    The search admin is for setting the maximum word length, minimum word length, selection to involve typical words, plus the alternative to consist of numbers.
  • Search Input Module
    A module or skin object is often made use of to provide the form for the search query. In module settings, you may make use of the default button, or an image. You do not have the selection to transform this image inside the module, nor change the text. Types is often made use of to produce some look and feel modifications, nevertheless it is limited. When a search is performed, the user is redirected for the Search Results web page.
  • Search Outcomes Module
    This module offers the search benefits. Within the settings, you can set the maximum search results, final results per page, maximum title length, maximum description length, along with the selection to show description. Final results are restricted for the exact word queried.


SEARCH DotNetNuke

The ISearchable interface is utilised to permit the users of one's module to look for content material employing the search mechanism provided by the DotNetNuke framework It works a lot more like an index inside the back of a book. The only things in the index are products that the author (in this case the module developer) has decided to put there. The search merely enables DotNetNuke portal users to speedily find things placed within this index.

Implementing Look for the Survey Module

To implement search for the Survey module we performed three measures:

Indicate that the controller class will implement the ISearchable interface

  • Insert the code for the ISearchable interface
  • Update the module configuration

Implement ISearchable in the Controller Class

When you look at the module definition for the Survey module, you can see that the controller

class defined is DotNetNuke.Modules.Survey.SurveyController
Public Function GetSearchItems(ByVal ModInfo As Entities.Modules.ModuleInfo) _
As Services.Search.SearchItemInfoCollection Implements Entities.Modules.ISearchable.GetSearchItems
' Get the Surveys for this Module instance
Dim colSurveys As List(Of SurveyInfo) = GetSurveys(ModInfo.ModuleID)
Dim SearchItemCollection As New SearchItemInfoCollection
Dim SurveyInfo As SurveyInfo
For Each SurveyInfo In colSurveys
Dim SearchItem As SearchItemInfo
SearchItem = New SearchItemInfo _
(ModInfo.ModuleTitle & " - " & SurveyInfo.Question, _
SurveyInfo.Question, _
SurveyInfo.CreatedByUser, _
SurveyInfo.CreatedDate, ModInfo.ModuleID, _
SurveyInfo.SurveyId, _
SurveyInfo.Question)
SearchItemCollection.Add(SearchItem)
Next
Return SearchItemCollection
End Function

To implement the search we performed 3 methods:

  • Developed and filled a SearchItemInfo object
  • Added this object for the SearchItemInfoCollection collection
  • Returned the SearchItemInfoCollection as the output for the approach
  • The essential point to remember is that the SearchKey parameter has to be a one of a kind value. In this case we passed the contents from the SurveyId field (in the Surveys table) towards the SearchKey parameter.
  • The Content material is the content that the portal customers will likely be looking on. We passed the contents on the Question field towards the Content parameter. As you are able to see within the table schema under, the Question field includes a direct one-to-one connection together with the SurveyID field.

This line adds the SearchItemInfo object for the SearchItemInfoCollection collection:
SearchItemCollection.Add(SearchItem), This line returns the SearchItemInfoCollection collection because the output on the technique:

Return SearchItemCollection

Best DotNetNuke Hosting Recommendation

ASPHostPortal.com
ASPHostPortal.com provides its customers with Plesk Panel, one of the most popular and stable control panels for Windows hosting, as free. You could also see the latest .NET framework, a crazy amount of functionality as well as Large disk space, bandwidth, MSSQL databases and more. All those give people the convenience to build up a powerful site in Windows server. ASPHostPortal.com offers DotNetNuke hosting starts from $5/month only. We also guarantees 30 days money back and guarantee 99.9% uptime. If you need a reliable affordable DotNetNuke Hosting, we should be your best choice.




DotNetNuke Hosting - ASPHostPortal.com :: Writing a New Authentication in DotNetnuke

clock February 2, 2017 05:00 by author Armend

My companion organization already had ADFS setup. My purpose was to have the partner organization authenticate the user after which have DNN automatically recognize the user, not obtaining to enter any far more credentials. From there we wanted to manage the groups and permissions by way of the standard DNN portal.
I was initially beneath the misconception that I couldn't make use of the present DNNMembershipProvider and I'd have to generate a whole new Authentication Provider and gather the credentials and pass them to my partner organization.

What I have figured out is that you can use the existing DNNMembership provider, but you've got to make the user ahead of the request gets towards the DNNMembership provider making use of the info offered by ADFS.

Note: This approach is really a straight pass-through from ADFS to DNN. No measures are taken to authenticate the user or to check any from the inputs from ADFS.

As an aside, this method performs not just with ADFS but in addition any other external 3rd-party Authentication approach that sends user info in headers or cookies. Change the context_AuthenticateRequest approach to suit your requirements.

Right here are the pre-conditions to this article. I expect:

  • Your partner organization has ADFS up and running
  • You have your ADFS proxy up and running and it talks to the partner organization.
  • ADFS Web Agent is installed on the server you are running.

Let’s get begin.

HTTPModule

What you've to complete is produce an HTTPModule that will intercept the AuthorizeRequest events ahead of DNN does. An over-simplified definition of an HTTPModule is, it is a piece of code that runs ahead of any web page gets hit. You can listen for a large amount of distinct events. For much more data, click right here.

To make the HTTPModule you'll need to:

  • Open Visual Studio and produce a brand new class library.
  • Generate a brand new class and copy the code attached to this blog.
  • Add References to the following DLLs
    • DotNetNuke
    • System.Web
    • System.Web.Security.SingleSignOn
    • System.Web.Security.SingleSignOn.ClaimsTransform
    • System.Web.Security.SingleSignOn.Permissions
  • Compile the solution
  • The DLL that is created will need to be placed in the bin directory of your website.
  • Make changes to your web.config (explained in a later section).

I will walk through a bit of the code. Here is the first snippet of code. We start listening for the AuthenticateRequest event. All other events pass through untouched.

public void Init(HttpApplication context)
{
//Start listening for each authentication request
context.AuthenticateRequest += new EventHandler(context_AuthenticateRequest);
}

Now, what do we do when this event is fired off? To shorten the namespace I added the statement

using SSO = System.Web.Security.SingleSignOn;

First off, we need to get the information that ADFS has sent us by casting the User.Identity into the ADFS object SingleSignOnIdentity.

public void context_AuthenticateRequest(object sender, EventArgs e)
{
HttpApplication app = (HttpApplication)sender;
//By the time the request gets to here, it should have been authenticated
//against ADFS.
SSO.SingleSignOnIdentity id = (SSO.SingleSignOnIdentity)app.User.Identity;

At this point you will have access to the user’s Identity and any claims coming from the ADFS server. You can access them through id.SecurityPropertyCollection. You can use them to populate the new user account. You can iterate through the claims with the following code

foreach(SecurityProperty sp in id.SecurityPropertyCollection)
{
    Console.WriteLine(sp.Name);
    Console.WriteLine(sp.Value);
}

Subsequent, we check to determine in the event the use currently exists within the database by utilizing the DNN API function GetUserByName. If it doesn’t, then the user is created by the common DNN API function CreateUser and logged in. If the user does exist currently then we log them in automatically. The user will automatically be added to the Registered Users and Subscribers security groups.

//'See if user exists in DNN Portal user DB
UserInfo objUserInfo = UserController.GetUserByName(currentPortal.PortalId, id.Name);
//' user does exist - try to create on the fly
if (objUserInfo == null)
{
    objUserInfo = new UserInfo();
    objUserInfo.DisplayName = id.Name;
    objUserInfo.FirstName = id.Name;
    objUserInfo.LastName = id.Name;
    objUserInfo.Username = id.Name;
    objUserInfo.Membership.Password = "AReallyStrongPassword";
    objUserInfo.PortalID = currentPortal.PortalId;
    objUserInfo.Email = id.Name;
    UserCreateStatus objUserCreateStatus = UserController.CreateUser(ref objUserInfo);
    //See if the user was added successfully
    if (objUserCreateStatus == UserCreateStatus.Success)
    {
        //We have created them successfully, so let them into the site
        LetsLogUserIn(objUserInfo);
    }
    else
    {
        //This will send the error to the error log, but the user will experience an infinite loop
        throw new Exception("User not created successfully: " + objUserInfo.Username + "- " +         objUserCreateStatus.ToString());
}

Here is the LetsLogUserIn function:

private void LetsLogUserIn(UserInfo objUserInfo)
{
    try
    {
    //Get the current portal
    PortalSettings currentPortal = PortalController.GetCurrentPortalSettings();
    //set the language to the default language of the portal
    Localization.SetLanguage(currentPortal.DefaultLanguage);
    //Log the user in
        UserController.UserLogin(currentPortal.PortalId,
            objUserInfo,
            currentPortal.PortalName,
            HttpContext.Current.Request.UserHostAddress,
            false);
    }
    catch(Exception ex)
    {
        Exceptions.LogException(ex);
    }
}

Web.Config

We need to make several changes to the web.config. First we need to make the changes necessary for ADFS and then we need to make changes for our HTTPModule.

The ADFS changes are the standard web.config changes you would do for any ADFS claims-aware site. You first need to add the section groups to your web.config.

<sectionGroup name="system.web">
    <section name="websso" type="System.Web.Security.SingleSignOn.WebSsoConfigurationHandler,                                  System.Web.Security.SingleSignOn, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, Custom=null" />
</sectionGroup>

Then you need to add the actual section. The <returnurl> needs to be EXACTLY what is put into ADFS. Remember, this URL needs to have a / at the end to prevent ADFS from posting to a directory listing. The <fs> element needs to be changed to reflect the name of your server.

<system.web>

    <websso>
        <authenticationrequired />
        <auditlevel>55</auditlevel>
        <urls>
            <returnurl>https://your_application/</returnurl>
        </urls>
        <fs>https://fs-server/adfs/fs/federationserverservice.asmx</fs>
    </websso>

</system.web>

If you would like to have logging (and who doesn’t like loggingJ) you will need to add the following section at the end of your web.config

<configuration>

<system.diagnostics>
     <switches>
       <!-- enables full debug logging -->
       <add name="WebSsoDebugLevel" value="255" />
     </switches>
     <trace autoflush="true" indentsize="3">
       <listeners>
         <!-- either create a c:\logs directory and grant Network Service permission to write to it, or remove this listener -->
         <add name="MyListener"
              type="System.Web.Security.SingleSignOn.BoundedSizeLogFileTraceListener, System.Web.Security.SingleSignOn, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, Custom=null"
              initializeData="c:\logs\webagent.log" />
       </listeners>
     </trace>
   </system.diagnostics>
</configuration>

Ultimately, you need to add the HTTPModules for ADFS and our HTTPModule. Order matters a good deal for the HTTPModules. We require the ADFS Web Agent to become listed first, to ensure that any request will likely be redirected to our partner’s logon screen. Right away following the Web Agent should be our HTTPModule. This will make sure that we'll automatically log them on just before DNN even see it.

<system.web>
<httpModules>
    <add name="Identity Federation Services Application Authentication Module"                       type="System.Web.Security.SingleSignOn.WebSsoAuthenticationModule, System.Web.Security.SingleSignOn, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, Custom=null" />
 
    <add name="HTTP_Module_Test" type="HTTP_Module_Test.SSO_Module, HTTP_Module_Test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"/>

There you have it Hope it helps someone.

Best DotNetNuke Hosting Recommendation

ASPHostPortal.com provides its customers with Plesk Panel, one of the most popular and stable control panels for Windows hosting, as free. You could also see the latest .NET framework, a crazy amount of functionality as well as Large disk space, bandwidth, MSSQL databases and more. All those give people the convenience to build up a powerful site in Windows server. ASPHostPortal.com offers DotNetNuke hosting starts from $5/month only. We also guarantees 30 days money back and guarantee 99.9% uptime. If you need a reliable affordable DotNetNuke Hosting, we should be your best choice.

Save



DotNetNuke Hosting - ASPHostPortal.com :: Simple Trick CSS Image Replacement in DNN

clock January 31, 2017 10:24 by author Dan

According to DNNgallery website. I've used quite a few image replacement techniques in web design in the past to create better typography for the web. But recently I've ran into a technique improved by Scott Kellum that proved to be effective as well as enhancing the performance of the site.

If you're a web designer, you've probably heard of Fahrner Image Replacement technique. It's essentially using CSS text-indent property and set it to a very larger negative number such as -9999px so the text isn't visible to users.

The technique is known for having a performance drawback since the browser has to draw the screen out to the measurement defined in the CSS. Jeff Zeldman recently published an improved technique in his post about this fix based on Scott Kellum's refactor code as follows:

.hide-text {
         text-indent: 100%;
         white-space: nowrap;
         overflow: hidden; }


So use this in your next web design project to eliminate performance drawback in the CSS.

Best Recommended DotNetNuke Hosting

ASPHostPortal.com is the leading provider of Windows hosting and affordable DotNetNuke Hosting. DotNetNuke Hosting from ASPHostPortal.com provides a safe, reliable and performance-driven foundation for your DotNetNuke website. DotNetNuke is the perfect Content Management System for managing and developing your website with one of ASPHostPortal’s Hosting plans. ASPHostPortal has ability to support the latest Microsoft and ASP.NET technology, such as: WebMatrix, WebDeploy, Visual Studio 2015, .NET 5/ASP.NET 4.5.2, ASP.NET MVC 6.0/5.2, Silverlight 6 and Visual Studio Lightswitch, ASPHostPortal guarantees the highest quality product, top security, and unshakeable reliability, carefully chose high-quality servers, networking, and infrastructure equipment to ensure the utmost reliability.



DotNetNuke Hosting - ASPHostPortal.com :: Simple Steps to Add Text in DNN Search Box

clock January 24, 2017 07:45 by author Dan

According to mndnn website. While trolling around the DNN forums, I found a post by someone looking to add the text "Search" to the DNN Search box. I've done this several times, and I use a javascript snippet. For those that are looking for something similar, see below.
 
$(document).ready(function() {
 $('#dnn_dnnSEARCH_txtSearch').val('Search Our Site'); //add the search text to the search input
    $("#dnn_dnnSEARCH_txtSearch").focus(function () { //clear the default text out of the search input
        if ($(this).val() == "Search Our Site") {
            $(this).val('');
        }
    });
});


This will add the text "Search Our Site" to the search box. When the user clicks on the box, the text is erased.

The best place to add this is in your skin files. Make sure you are using jQuery.

Best Recommended DotNetNuke Hosting

ASPHostPortal.com is the leading provider of Windows hosting and affordable DotNetNuke Hosting. DotNetNuke Hosting from ASPHostPortal.com provides a safe, reliable and performance-driven foundation for your DotNetNuke website. DotNetNuke is the perfect Content Management System for managing and developing your website with one of ASPHostPortal’s Hosting plans. ASPHostPortal has ability to support the latest Microsoft and ASP.NET technology, such as: WebMatrix, WebDeploy, Visual Studio 2015, .NET 5/ASP.NET 4.5.2, ASP.NET MVC 6.0/5.2, Silverlight 6 and Visual Studio Lightswitch, ASPHostPortal guarantees the highest quality product, top security, and unshakeable reliability, carefully chose high-quality servers, networking, and infrastructure equipment to ensure the utmost reliability.



DotNetNuke Hosting - ASPHostPortal.com :: How to Create Different Level Navigation in DNN

clock January 17, 2017 15:00 by author Dan

According to mndnn website, If you ever need to dynamically output two different levels of menu in the same skin, read below. In some cases you may need a primary or secondary page to show it’s children and the child page to show it’s siblings.

You can do that in the same skin. This example uses the DNN Garden menu, but it could be any provider where the levels are specified

<div id="side-nav">

<%  If PortalSettings.ActiveTab.Level < 1 Then%>

<ddr:MENU ID=”MENU2″ MenuStyle=”ULMenu” runat=”server” NodeSelector=’0,0,1′ ExcludeNodes=”Admin, Host” />

<% Else%>

<ddr:MENU ID=”MENU3″ MenuStyle=”ULMenu” runat=”server” NodeSelector=’-1,0,2′ ExcludeNodes=”Admin, Host” />

<% End If%>

</div>


Now I can use the same skin for two levels of hierarchy. Using DNN Garden, the node selector determines the depth of the menu.

Now on my primary pages, I can show the children. On the child pages, I can show it's siblings.

Best DotNetNuke Hosting Recommendation

ASPHostPortal.com provides its customers with Plesk Panel, one of the most popular and stable control panels for Windows hosting, as free. You could also see the latest .NET framework, a crazy amount of functionality as well as Large disk space, bandwidth, MSSQL databases and more. All those give people the convenience to build up a powerful site in Windows server. ASPHostPortal.com offers DotNetNuke hosting starts from $5/month only. We also guarantees 30 days money back and guarantee 99.9% uptime. If you need a reliable affordable DotNetNuke Hosting, we should be your best choice.



DotNetNuke Hosting - ASPHostPortal.com :: How To Develop Web Service in DNN

clock January 12, 2017 04:49 by author Armend

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

 

Best DotNetNuke Hosting Recommendation

ASPHostPortal.com provides its customers with Plesk Panel, one of the most popular and stable control panels for Windows hosting, as free. You could also see the latest .NET framework, a crazy amount of functionality as well as Large disk space, bandwidth, MSSQL databases and more. All those give people the convenience to build up a powerful site in Windows server. ASPHostPortal.com offers DotNetNuke hosting starts from $5/month only. We also guarantees 30 days money back and guarantee 99.9% uptime. If you need a reliable affordable DotNetNuke Hosting, we should be your best choice.



DotNetNuke Hosting - ASPHostPortal.com :: Easy Steps to Solve Problems logging in after upgrading DNN

clock January 3, 2017 12:07 by author Dan

According to nwds-ak website. The information in this article applies to:

DotNetNuke - DNN
Upgrade Installation Options
DotNetNuke Upgrade Instructions -- DotNetNuke problems logging in after upgrade solution

If the DNN installation uses third-party modules that includes custom entries in the web.config file, the customer should consult with their vendor on the best way to perform an upgrade.

1. Rename the web.config file old_web.config

2. Extract DotNetNuke upgrade package


Now you need to extract all files from the DotNetNuke upgrade package into your root DNN folder or sub-folder if DNN is installed to a sub-folder. You will need to confirm the overwriting of your files. Once this process has completed, rename the release.config file to web.config and perform the following steps using the information from your old_web.config file

3. Update Connection Strings

Be sure that the proper connection strings are loaded for your setup, both in the <connectionstrings>and <appsettings> sections of your web config, examples are provided below.
<connectionStrings >
   
     < add  name ="SiteSqlServer" connectionString ="<yourconnectionhere>" providerName ="System.Data.SqlClient"  />
   connectionStrings >
   < appSettings>
     <!-- Database connection string (SQL Server 2000 or 2005 - kept for backwards compatability - legacy modules -->
     < add  key ="SiteSqlServer" value ="<yourconnectionhere>" />


4. Turn off AutoUpgrade

5. Copy Machine Key and Validation Key Values

Another very important item to copy over is your machine and validation keys from the old_web.config file. These are the keys used to encrypt and decrypt passwords and other information within your application. Failure to do this will result in your users including the admin and host user not being able to login. Below is an example of the machine key, the values you will be concerned with are the ones that note "<value to copy>".
<system.web >
     < machineKey  validationKey ="<value to copy>"  decryptionKey="<value to copy>"  decryption="3DES"  validation="SHA1"   />


6. Check and Update ObjectQualifer Line if necessarey

When Re-invent performs a free installation of DotNetNuke - DNN to a customers site we use an ObjectQualifer on line 321 in the web.config file before installation.   For example, if installing DNN v4 we change this line:

objectQualifier=""

to this:="DNN4"


7. Start Upgrade Process

After completing the above setup you are now ready to start the upgrade process.  You will want to delete your app_offline.htm file if you created one so that you can access your site again.  Now simply navigate to <yourSite>/Install/Install.aspx?mode=upgrade.  Once the page appears you should see a status screen that shows you the progress as the site is upgraded.  At the end you should see an upgrade complete message with a link to your portal.  You should not see ANY errors on this page, if you encountered an error be sure to note ALL information displayed so you can investigate the issues.

objectQualifier

This creates all SQL tables in the database with a Prefix of DNN4_.  This allows customers to differentiate between what tables are used for DotNetNuke and what tables are used for other applications you may have on your site.

You can check the ObjectQualifier by logging into your database to see if one was used.  If one was used you must change the ObjectQualifier line to match, otherwise leave it blank if no ObJectQualifer was used.

By default DotNetNuke will be set to "AutoUpgrade", this means that the first user to hit the default.aspx page on any portal within your DNN installation will trigger the upgrade process.  This is typically not a desired result as if an error occurs you might not be able to see the error log since the other individual started the upgrade.  The way around this is to update the "AutoUpgrade" appSetting, if you set this to "false" you will be required to navigate to the <yoururl>/Install/Install.aspx page to perform the upgrade.
<add  key ="AutoUpgrade"  value ="False"   />

Best DotNetNuke Hosting Recommendation

ASPHostPortal.com provides its customers with Plesk Panel, one of the most popular and stable control panels for Windows hosting, as free. You could also see the latest .NET framework, a crazy amount of functionality as well as Large disk space, bandwidth, MSSQL databases and more. All those give people the convenience to build up a powerful site in Windows server. ASPHostPortal.com offers DotNetNuke hosting starts from $5/month only. We also guarantees 30 days money back and guarantee 99.9% uptime. If you need a reliable affordable DotNetNuke Hosting, we should be your best choice.



DotNetNuke Hosting - ASPHostPortal.com :: How To Improvement Performance in DNN

clock December 22, 2016 04:46 by author Armend

I have been seeing a big number of concerns not too long ago with regards to DotNetNuke functionality and items that will be done to help improve the overall performance in the internet site. Usually these questions surround the SiteLog and EventLog tables so I thought I'd post a number of simple queries which you can run to assist hold your database lean that will preserve your DotNetNuke website running at peak efficiency.

Website Log

I'll start off using the Internet site Log table, the website log functionality isn't a single that I truly utilize in my site, nonetheless for all those of you who use it in yours you are going to need to hold an eye on it, I have noticed that right after the log has grown to more than about 4-5 thousand records that you could begin to notice some efficiency decreases. Furthermore if you're like myself and have turned off the internet site log I found out that it will not necessarily clean itself up in case you turned it off, therefore in my case I had 1000 lingering records, which just unnecessarily improved the size of my database.

To check the amount of records within your Site Log use the following query

SELECT Count(*)
FROM SiteLog

To find the oldest record in the site log use the following

SELECT MIN([DateTime])
FROM SiteLog

Soon after you've viewed this details you can establish your necessary course of action. In my case since the internet site log is disabled on all portals I simply deleted all records in the table employing a basic delete statement. Within your case you could only want to purge certain records but that determination is outdoors the scope of this short article.

Event Log

The Occasion log shops portal certain event details like logins, invalid login attempts and actual errors. If you have a pretty active portal this table can grow very big really quickly. For my sites with their visitors of about 100-120 guests per day I have noticed an EventLog of over 2000 records within a two.five month period. Now unless you happen to be auditing logins or undertaking particular tracking you are able to normally rid yourself of those records without much impact. You'll be able to purge these portal by portal via the "Event Viewer" inside DotNetNuke, or it is possible to view and modify records by way of the database. Beneath I'll give you two valuable queries.

To determine the number of records, as well as the quantity of records per portal. Note, inside the benefits in the per portal query, you are going to discover a lot of entries listed having a NULL portal id, that is for DNN installation wide things, like scheduler and application events.

--Overall total
SELECT COUNT(*)
FROM EventLog

--Total by portal (null is not portal specific)
SELECT LogPortalId, COUNT(*)
FROM EventLog
GROUP BY logPortalId

To identify the oldest records you can use one of the following queries, again an overall minimum and a per portal minimum will be found

SELECT MIN(LogCreateDate)
FROM EventLog

SELECT LogPortalId, MIN(LogCreateDate)
FROM EventLog
GROUP BY logPortalId

Once again for deleting these records the decision truly depends upon your portals use on the Occasion Log and any require for user login auditing. In my case I once again don't require this details and at present I've resolved all of my routine errors that had been taking place, for that reason I removed all records in my listing across all sites. I try to complete this at the very least as soon as as month to ensure that the table size has been decreased.

Viewing DB Size

If you would like to view the size of one's database files you are able to make use of the query below to view the size of every single file for the present database.

SELECT *
from SYSFILES

Making use of these ideas you'll be able to start to acquire a better understanding of the database size and you can assist handle it and preserve your DotNetNuke website running at peak efficiency!

Best DotNetNuke Hosting Recommendation

ASPHostPortal.com
ASPHostPortal.com provides its customers with Plesk Panel, one of the most popular and stable control panels for Windows hosting, as free. You could also see the latest .NET framework, a crazy amount of functionality as well as Large disk space, bandwidth, MSSQL databases and more. All those give people the convenience to build up a powerful site in Windows server. ASPHostPortal.com offers DotNetNuke hosting starts from $5/month only. We also guarantees 30 days money back and guarantee 99.9% uptime. If you need a reliable affordable DotNetNuke Hosting, we should be your best choice.



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


Corporate Address (Location)

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

Tag cloud

Sign in