Browse DevX
Sign up for e-mail newsletters from DevX


Building an Internet Portal (for Free!) with DotNetNuke : Page 2

Save hours of valuable development time building corporate or departmental Web portals with DotNetNuke—a free, ASP.NET-based, open source, extendable, content management portal based on the IBuySpy Solution Kit.




Building the Right Environment to Support AI, Machine Learning and Deep Learning

Performing a Clean Install
Figure 1: The DotNetNuke Web site located at www.dotnetnuke.com.
Ok, now that you've had a chance to check out a few sites developed with DNN, let's start by walking through how to build a site of your own. We'll walk through all the steps to get you up and running including downloading the source code, configuring IIS, and creating a database. Before we get started, let me tell you how my development environment is configured. I'm running Windows XP SP1, IIS 6.0, VS.NET 2003, .NET Framework 1.1, and SQL Server 2000. I am logged on as an Administrator.

Step One: Download the DotNetNuke Portal Code
Let's start by downloading the DotNetNuke code from the DotNetNuke site at www.dotnetnuke.com (see Figure 1). An interesting note about the DotNetNuke site is that it was created with and is maintained with DNN itself. There isn't anything on the DNN site that is not part of the built-in portal feature set. That doesn't mean you cannot extend the default portal though. (I'll write more on that later when I discuss developing custom modules.)

Figure 2: A typical DotNetNuke registration form collects a number of pieces of information about registered users.
OK, back to downloading the code. A DNN site lets you assign roles-based access to specific content on the site. The DNN site (www.DotNetNuke.com) has done just that with access to downloading the code. The site requires that you register and then login to the site before you can download the code.

You won't have any difficulty registering. Click Register in the upper right hand corner of the page and fill out the registration form (see Figure 2). Once you complete and submit the registration page, DNN will send you an email with a verification code to use the next time you log in to the site (see Figure 3). With your verification code in hand, you can now log in to the DotNetNuke site. Click Login in the upper right hand corner of the page and an Account Login module will appear in the upper left hand corner. Enter your username and password and click Log In. Since this is your first time accessing the site, instead of logging you in immediately, the site will prompt you for your verification code (see Figure 4).

Figure 3: DNN will auto-generate a registration confirmation email with a Verification Code the user enters the first time they log in to your portal.
Enter the verification code you received via email and click Log In. If all goes well and you log in successfully you will see your name in the upper right-hand corner of the page. Finally, you can get to the DNN code. Click Downloads from the top menu and then click the Download link. For simplicity, save the zip file containing the code to C:\DotNetNuke. Once you've downloaded the file, extract the zip file to the same C:\DotNetNuke directory. Take a quick look at the directory and you'll see a directory structure and the associated DNN files (see Figure 5).

A close inspection of the C:\DotNetNuke directory reveals a VS.NET solution file (DotNetNuke.sln) and a VS.NET project file (DotNetNuke.vbProj). These are VS.NET 2002 files so you'll need to upgrade them if you open them in VS.NET 2003.

Figure 4: Logging on your first time requires that you enter the Verification Code.
The DesktopModules directory contains the source files associated with the built-in modules. In the Documentation directory you'll find a readm.txt file that walks you through the steps for a clean installation. The DNN architecture revolves around ASP.NET's ability to add user controls to a page at runtime. (See my article, "Dynamically Adding Controls" in the Jan/Feb 2004 issue of CoDe Magazine.) The DeskTopDefault.aspx page, located in the C:\DotNetNuke directory, hosts the user controls (modules) that the portal displays as it runs. The DeskTopPortalBanner.ascx file, located in the C:\DotNetNuke\Controls directory, controls the look and layout of the header for each page in the portal. It doesn't take a rocket scientist to figure out that the DeskTopPortalFooter.ascx file, also located in the C:\DotNetNuke\Controls directory, controls the look and layout of the footer for each page. I'm explaining this now to give you some background on how DNN does what it does. You won't need to concern yourself with these files in order to get your portal built.

Figure 5: Here is the default directory structure created after extracting the downloaded DNN zip file.
Step Two: Give ASPNET Permissions on the Root Folder
Next, you need to make sure that the ASPNET user, created when you installed the .NET Framework, has full control privileges on the root DNN folder, C:\DotNetNuke. How you do this varies slightly based on which OS you're running. Start by right-clicking on the C:\DotNetNuke folder and select Sharing (or something similar). Select the Security tab or locate the Permissions button. You want to locate the ASPNET user and assign "Full Control" to the C:\DotNetNuke folder.

Figure 6: You won't get very far without first creating the DotNetNuke database in SQL Server 2000.
Step Three: Create an IIS Virtual Directory
Next you want to tackle the chore of creating an IIS virtual directory for your new portal. Open Internet Information Services and drill down to and select the Default Website. Right-click on Default Website, select New, and then select Virtual Directory. IIS will launch the Virtual Directory Creation wizard. Click Next to move to the Virtual Directory Alias step and type DotNetNuke. Click Next to move to the Web Site Content Directory step and browse your way to (or enter) C:\DotNetNuke. Click Next to move to the Access Permissions settings. Click Next to accept the defaults. This takes you to the last step in the wizard. Click Finish to complete the creation of the DotNetNuke virtual directory. Step Four: Create a SQL Server Database
When you open a portal for the first time, DNN executes a SQL Server script that populates a blank database with the DNN tables and stored procedures. Note that DNN's script does NOT create the database so it needs to exist before you open the portal for the first time.

I'll walk you through how to build a SQL Server database named DotNetNuke. You may name the database for your next portal something else more descriptive, but for now let's stick with a database named DotNetNuke. Open the SQL Server Enterprise Manager, drill down into the server you want to create the database on, select Databases, right-click, and select New Database. Enter DotNetNuke as the name of the database and click OK (see Figure 6). Database creation step complete, mission accomplished!

Figure 7: The Web.Config file contains a number of portal settings including the Server, UID, and PWD connection string values.
With the database done, you need to make sure you tell DNN about the DotNetNuke database. DNN stores the database connection information in the Web.Config file contained in the portal's root directory, C:\DotNetNuke. Open the Web.Config file with a plain text editor like Notepad and enter the appropriate settings for your server name, user id (uid), and password (pwd). You won't have to specify the name of the database for this portal since it defaulted to DotNetNuke. Since I'm developing this portal on my laptop, I chose the localhost server (the default setting), sa as the user id, and secret as the sa password (see Figure 7). Please note that I'm using the sa userid here for demonstration purposes only. You should use another account in a production environment.

Figure 8: You know things went right the first time you access the portal if the above page displays.
Step Five: Open the Portal for the First Time
Now seems like a good time for a quick review. You've downloaded the DNN portal code and set it up in C:\DotNetNuke. You've created an IIS virtual directory pointing at the C:\DotNetNuke directory, you've created a DotNetNuke database, and you've modified the connection settings in the Web.Config file to work with your SQL Server. At this point you're ready to open your portal for the first time, which will run the SQL Server script to create the necessary tables and stored procedures. Launch your new portal by pointing Internet Explorer at http://localhost/dotnetnuke. If everything works correctly, DNN will create the required tables and stored procedures in your database (more about this later), and you can see your new portal in the browser (see Figure 8).

Thanks for your registration, follow us on our social networks to keep up-to-date