DNN Blog

Easy DotNetNuke LightSwitch Deployment

by Michael Washington on Monday, May 23, 2011 1:00 AM

image

(this is a cross posted from the LightSwitch Help Website)

Integrating a LightSwitch application into DotNetNuke has been covered before in Deploy Your LightSwitch Application As A DotNetNuke Module. The problem with that solution is:

  • It requires a lot of assemblies to be added to your DotNetNuke site
  • It requires edits to your DotNetNuke site’s web.config file
  • You can only deploy one LightSwitch application to a DotNetNuke site

The third one is usually a show-stopper. This method, using IFrames, gets around all those problems.

 

The Application

 

image

We start with the application used in It Is Easy To Display Counts And Percentages In LightSwitch.

image

In that application, we wire-up a method on the PhoneCall table and add the following code:

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.LightSwitch;
namespace LightSwitchApplication
{
    public partial class PhoneCall
    {
        partial void PhoneCall_Created()
        {
            MessageTakenBy = this.Application.User.Name;
        }
    }
}

 

That is all that is required to integrate the application into DotNetNuke. When a user is logged-in, DotNetNuke will pass the authenticated User Name to the LightSwitch application, so it can save the user that creates the Phone Call record.

 

image

We go into Properties and turn on Forms Authentication.

image

We also set the application to be a Web Application that is deployed on IIS.

image

In the Visual Studio Configuration Manager, we switch to Release.

image

We then Publish the application.

image

When we get to the database screen, we specify the DotNetNuke database.

 

Calling The LightSwitch Application From DotNetNuke

image

We follow the directions in this post by LightSwitch team member Valerie Andersen:

http://social.msdn.microsoft.com/Forums/en-US/lightswitchgeneral/thread/60c76dde-07dd-48f7-8aed-f7aec66c47d4

Essentially we need to:

  • Copy the Machine Key from the DotNetNuke web.config to the LightSwitch application
  • Make some more minor edits to the web.config of the LightSwitch application

image

Next, we download and install the DotNetNuke IFrame module from: http://dnniframe.codeplex.com.

image

We configure the module to point to the LightSwitch application…

image

… and it just works.

image

The sample application also contains the LightSwitch Filter Extension (covered in Using The LightSwitch Filter Extension).

 

Download

You can download the code at this link.

Author

My personal DotNetNuke blog.

4 comment(s) so far...

l0Ft 6/10/2011

Michael, do we need to create a new admin after deploying ?

 

@l0Ft - Because the LightSwitch app is using the DotNetNuke database, you simply use your current DotNetNuke users.

 
l0Ft 6/14/2011

Michael, i've had to create an admin on the DNN database using Microsoft.LightSwitch.SecurityAdmin.exe as Valerie said. <br /><br />Using the users on the DNN database simply won't log me into the Lightswitch application. Am I doing anything wrong here?

 

@10Ft - You log into the DotNetNuke site first, then you are automatically authenticated in the LightSwitch application. <br />

Attend A Webinar
Start  Professional Edition Trial
Have Someone Contact Me

Like Us on Facebook Join our Network on LinkedIn Follow DNN Corporate on Twitter Follow DNN on Twitter

Advertisers

Sponsors

DotNetNuke Corporation

DotNetNuke (DNN) provides a suite of solutions that make designing, building and managing feature-rich sites and communities fast, easy and cost-effective. The DotNetNuke Platform CMS is the foundation for more than one million websites worldwide. DNN Social, our newest solution, enables businesses to create immersive, interactive communities. Thousands of organizations like True Value Hardware, Bose, Cornell University, Glacier Water, Dannon, Delphi, USAA, NASCAR, Northern Health and the City of Denver have leveraged DNN to deploy highly engaging business- critical websites. Our rapid growth in product sales and deployments resulted in DotNetNuke Corp. being named one of the fastest growing private companies in America by Inc. Magazine in 2011 and 2012.