Getting Started, "Create a Web Portal Module," by Stan Schultes [Visual Studio Magazine, December 2003]

Requirements for running DotNetNuke (DNN) v1.0.10 (or later) are an IIS web server with the .NET Framework and the Microsoft Mobile Internet Toolkit installed, and SQL Server (or MSDE) on the backend (either on the same server or a separate machine). Be sure to read the installation and release notes that come with the portal code. A data access layer (DAL) is planned for a future release that will let the portal run with other databases such as Oracle, Access, or MySQL. The source code for v1.0.10 builds in Visual Studio .NET 2002 and expects the .NET Framework v1.0. The code should work with VS.NET 2003 and .NET Framework v1.1. There's no SDK version of DNN, nor a C# version at the present time.

First bring up the basic DNN portal. Start by downloading the DNN code (http://www.dotnetnuke.com) - register at the site to see the download menu. Follow the setup instructions in the download. In a nutshell, the steps are:
- unzip the download into a directory using directory names.
- set the ASPNET account to have full control over the project directory structure in Windows security.
- create an Internet Information Server (IIS) virtual directory (vdir) pointing to the code location.
- manually create an empty database using SQL Enterprise Manager or your other favorite tool.
- modify the web.config file for your database connection.
- browse to the new vdir (in a browser, not VS.NET).
The portal code automatically creates the database objects and starts up. Upgrading is equally easy - unzip the new code into your directories and browse to your vdir (assuming you've made no portal core changes). The portal code automatically executes the database upgrade scripts. Be sure you back everything up before you try an upgrade, even on your development portal (certainly don't try an upgrade on a production portal before you test it on a development site).

To install the Suggestions module into your portal:
- log into the portal using the Host account (password is host by default). 
- go to the Host -> Module Definitions tab and click the Add New Module Definition link. 
- click the Upload New File link and browse to the location of the Suggestions 1.0 Install.zip file. Add the file to the upload list box, and click the Upload Files link (make sure the Decompress Zip Files checkbox is checked). 
- back on the Module Definitions page, choose Suggestions from the Installation Script dropdown list and click the Install link.
- this puts the needed files in their proper directories and creates the database tables and SPs. 
- You can now add and use the Suggestions and Suggestions Display modules in your portal.

Suggestions and Suggestions Display module use:
- Login as Admin, add a Suggestions module to a tab. 
- Click the Edit Module link (the pencil in front of the module title), and choose Registered Users in the Roles That Can Edit Content list. This lets only users who are logged on make suggestions. 
- Only the Tab admin or a site admin will see the ModuleOptions link (looks like a magifying glass on the module title bar) on the Suggestions module. Click this link to add suggestion types and change the instructions and thank you text.
- Add a DisplaySuggestions module to the tab. Click the Edit Module link and select a desired role in the Roles That Can View Content list. This lets only users in the selected role see the suggestions lists.
- The site admin will see all suggestions modules on the site listed in the Suggestions Display dropdown list.
- The tab admin will see only suggestions modules on the current tab listed in the Suggestions Display dropdown list.

There are several ways you can fit your own code into the DNN portal. The "official" approach is to build a Private Assembly (PA) that you can upload and install automatically. Two PA modules come with the v1.0.10 code so you can explore this mechanism: Survey and Whois. While this code is easy to install and use, debugging a new module with the example PA code structure is a bit troublesome. Following is the approach I used to develop and test the Suggestions module. 

I call this the source-integrated approach, which I found on a DNN community site (http://www.tag-software.com, or a slightly different one found on http://www.niquest.com. Both require registration for tutorial download). This allows you to build your custom module in a separate project, but debug it as if it was integrated with the portal. In a nutshell, here are the steps:
- open your DNN solution in VS.NET.
- add a new VB Class library project (Suggestions) to the DNN solution, create it in the DesktopModules directory.
- delete the default Class1.vb file from the new project.
- add a reference to the DNN project into your PA project.
- open your PA Properties page, and clear the root namespace field.
- on the PA properties page, go to the Configuration Properties -> Build tab and set the Output path to the DNN\bin directory.
- unzip the contents of the Suggestions 1.0 Sources.zip file into your portal's DesktopModules\Suggestions folder using folder names. 
- refresh the project in Solution Explorer and add the source files to the new project (.ascx & .vb files).
- execute the Suggestions.1.0.sql file from the database directory in Query Analyzer to create the tables and SPs. 
- you should now be able to run the DNN solution with the Suggestions project embedded in it.
- Note that the project is built in Release mode. If you want to debug the project, you need to set the project configuration to Debug and rebuild. This allows you to set breakpoints and step into the code.