Created By
DMG Development
As Seen On

Main Page  |  Forums  |  Register  |  Active Topics  |  Members  |  Search

 
Username:
Password:
DMG Forums >> DMG Forums Discussion >> Tutorials & HOWTO Articles >> Installing & Using DMG Forums Inside Another .NET Application Page of 3
Installing & Using DMG Forums Inside Another .NET Application
Author Topic
grimmeissen


Administrator


Join Date: 8/30/2005
Posts: 656
Location: Cincinnati, Ohio

Posted: 3/2/2006 6:15:33 PM

One of the greatest features of the DMG Forums application is versatility. This tutorial displays that even further as we show you how to install the forums to be run within another .NET application. This tutorial also explains in detail how to implement DMG Forums logins and user information from inside your base application.

grimmeissen


Administrator


Join Date: 8/30/2005
Posts: 656
Location: Cincinnati, Ohio

Posted: 3/2/2006 6:15:43 PM

Before attempting any of the customizations below, be sure that your base application is backed up and that any databases that it connects to are backed up. Review the installation instructions for DMG Forums as the basic setup steps will be left out of this tutorial. This tutorial assumes that your base application is already installed and is a functioning .NET application within IIS.

At the end of this tutorial we have provided a sample application that can be downloaded to set up on your server. The full source code for the sample application is included so you can view some of the features discussed in this article and how to implement them in the code.



Installing DMG Forums Inside Another Application

Download the latest release of DMG Forums and extract all of the files. If your application does not have a /bin folder under the root, you will need to create it. Move the .dll files from the /bin folder of DMG Forums into the /bin folder of your web site.

Next, you will need to copy the settings from the DMG Forums web.config file into the web.config file that is in your root directory. If you do not have a web.config file for your application, copy the one from the DMG Forums installation files into your root. If you already have a web.config, you will only need to copy the "DatabaseString" key from the "appSettings" section. Edit the web.config (as described in the README file for DMG Forums) to point to your server and database and enter a username/password that have administrator rights to the database.

Finally, create a folder under the root that will be used to place all of the forum markup pages. For this demonstration we will call it the /forums folder. Extract all of the .aspx files and sub-directories from the DMG Forums installation and place them in this directory. DO NOT copy the web.config file or the /bin folder to this directory because you have copied these files into the root.

At this point you can browse to http://ApplicationPath/forums/setup.aspx and install the forums. After you install the forums you need to remove the files setup.aspx and setup-update.aspx from the /application/forums/ folder and the file setup.dll from the /application/bin/ folder. Edit the web.config and point it to an account that only has read/write privileges to the database.



Displaying The DMG Forums Login Box In Your Base Application

After the forums are installed from within the same .NET application as the rest of your code, it is very simple to display a login box inside the root application to allow your users to log in from anywhere. The tag below will need to be placed just below the Page directive at the top of an .aspx page to register the login box as a custom control.

Code:
<%@ Register TagPrefix="DMG" TagName="Login" Src="inc_login.ascx" %>

With this tag in place, the following tag can be inserted anywhere within your .aspx file. The below tag will output a login box if the user is not logged in or a logout box if they are already logged in. These items will be placed where the tag is placed within the HTML.

Code:
<DMG:Login id="DMGLogin" runat="server" />

These tags can be placed inside any .aspx files in your application that you would like to display the login box on. Also, the controls can be created dynamically by importing the DMGForums.Global.Login class into a code-behind file.



Implementing User Information Inside Your Base Application

Beyond merely placing a login box inside your root web site, you can also display user information and utilize the information to perform user-based actions inside your application. There are four session variables that are created when a user logs into DMG Forums. The variables and their uses are shown below.

    Session("UserLogged") - Set to "1" for logged in, "0" if not logged in.
    Session("UserID") - Set to the user's ID number as defined in the database.
    Session("Username") - Set to the user's login name.
    Session("UserLevel") - Set to "3" for an administrator, "2" for a moderator, "1" for a normal member, and "0" for not logged in.

This information can be used in any way in your application. For example, if you have some text that you would only like forum members to read, you can check to see if Session("UserLogged") = 1. Also, checks can be made to see if a user is an admin or moderator.



A sample application can be downloaded HERE that contains a source file that shows how to create a login box within a base application and it shows how to use the Session variables. Download the .zip file and install it to an IIS virtual directory. Then follow the instructions above to install DMG Forums in the same IIS application and run the tests. You can also just download the file to view the source before implementing these features in your own application.

chrishocking


Newbie

Join Date: 10/17/2006
Posts: 2

Posted: 10/29/2006 3:59:12 PM

Hi.
Still trying to get DMG froums to work. I did put a message on the forum previously but got no reply and it doesnt appear on the forum.

When adding DMG inside an existing .NET application it maybe a good idea to say in your instructions to change the DMG Forums default.aspx to something like defaulfDMG. This will provent it overwriting existing default.aspx therby not allowing access to existing .NET application!

This\has\happened to me and my backup won't read! Oh and by the way despite attempting all week to get the forum to work (followed instructions for SQL Express) I still keep getting an error telling me SERVER doesnt exist. It does cause the forumDb shows as existing on SQLEXPRESS.
Any assistance would be appreciated.
Many thanks
Chris


grimmeissen


Administrator


Join Date: 8/30/2005
Posts: 656
Location: Cincinnati, Ohio

Posted: 10/29/2006 7:47:20 PM

The issue with SQLEXPRESS is determining what the name of the database instance is on the server. Sometimes it names it SERVERNAME\SQLEXPRESS and sometimes it just names it SERVERNAME.

I would think either the SQL service is not running or the server's instance name is not correct in the web.config file.

saamir


Newbie

Join Date: 2/14/2007
Posts: 3

Posted: 2/14/2007 2:33:26 AM

Hi
I am using DMG Forums in my .NET web application. I have followed the instructions. But when I run the application and try to open the setup page it gives the following compilation error:


Compiler Error Message: CS0117: 'ASP.setup_aspx' does not contain a definition for 'InstallForums'

Line 62: <td align="left" valign="middle">
Line 63: <font face="arial,helvetica" size="2">
Line 64: <asp:Button type="submit" id="Submit" onclick="InstallForums" text="Install" runat="server" />
Line 65: </font>
Line 66:
grimmeissen


Administrator


Join Date: 8/30/2005
Posts: 656
Location: Cincinnati, Ohio

Posted: 2/14/2007 8:39:24 AM

It sounds like your .aspx page is not being tied to the class as defined in /bin/setup.aspx. Your web application needs to be able to recognize the classes in the .dll files.

If this is in relation to installing DMG inside another .NET application, you will need to put the DMG .dll files in your root application's /bin directory.
saamir


Newbie

Join Date: 2/14/2007
Posts: 3

Posted: 2/14/2007 11:16:11 PM

I am still recieving the same error.

Compiler Error Message: CS0117: 'ASP.setup_aspx' does not contain a definition for 'InstallForums'

Line 62: <td align="left" valign="middle">
Line 63: <font face="arial,helvetica" size="2">
Line 64: <asp:Button type="submit" id="Submit" onclick="InstallForums" text="Install" runat="server" />
Line 65: </font>
Line 66:



I have added the reference of setup.dll file in the setup.aspx page as follows:
<%@ Import Namespace="DMGForums.Setup" %>

Do I have to write some code to run this page?
hers2keep


Newbie


Join Date: 3/23/2007
Posts: 3
Location: Fayetteville AR

Posted: 3/23/2007 10:00:54 AM

I had the forum set up and running from inside another asp.net site yesterday. Then last night I got the message and upgrade was available. So I downloaded the update (to v3.0) and followed the instructions to upgrade my current site. So far, so good. I got the successful update message. Then I changed the connectionstring userid and password and now I can't get the site to work. This is the error I get on the admin.aspx page:

Parser Error Message: Could not load type 'DMGForums.Admin.AdminPage'.

Source Error:

Line 1: <%@ Page language="VB" Inherits="DMGForums.Admin.AdminPage" %>

Does this have something to do with the upgrade? I don't have a page "DMGForums.Admin.AdminPage" at all. The forum is set up in a folder called "forum". In the forum folder, there is only admin.aspx. I don't see AdminPage anywhere.

What am I missing to get the forum working correctly again?

Carla M Romere
grimmeissen


Administrator


Join Date: 8/30/2005
Posts: 656
Location: Cincinnati, Ohio

Posted: 3/23/2007 11:42:37 AM

Are you running .NET Framework 2.0?

Starting with DMG Forums 3.0 it will only work in .NET 2.0.

DMGForums.Admin.AdminPage is the class in Admin.dll that is called by admin.aspx. If Admin.dll is in your /bin folder and you are getting this message, then your .aspx page is unable to read the DLL.

Since the DLL was compiled using .NET 2.0, if you are running 1.1 the .aspx page won't be able to read it.
brucehanson


Newbie


Join Date: 4/4/2007
Posts: 4

Posted: 4/4/2007 6:21:03 PM

I would like to know the compatability with Windows 2003 Server running IIS and SQL 2000. I am interested in running it on the backend of our website. Users log into the backend side of the website. We would like to setup a forum so logged in users can discuss topics and ideas in a private area after logging into the backend of our website. We use ASP with the SQL server for the website.

grimmeissen


Administrator


Join Date: 8/30/2005
Posts: 656
Location: Cincinnati, Ohio

Posted: 4/5/2007 8:24:56 AM

The forums are definitely compatible with Windows Server 2003 running IIS and SQL 2000. In fact, that is the current configuration for dmgforums.com. Just make sure you are running ASP.NET 2.0 or above and you will have no problems.
brucehanson


Newbie


Join Date: 4/4/2007
Posts: 4

Posted: 4/5/2007 4:15:35 PM

I was able to download the application and run it on the front end of our website but am unable to set it up on the backend of our website. I recieve this error:
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Could not load type 'DMGForums.Setup.SQLSetup'.

Source Error:


Line 1: <%@ Page language="VB" Inherits="DMGForums.Setup.SQLSetup" %>
Line 2:
Line 3: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">


Source File: /intranet/forum/setup.aspx Line: 1


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42


grimmeissen


Administrator


Join Date: 8/30/2005
Posts: 656
Location: Cincinnati, Ohio

Posted: 4/5/2007 4:45:57 PM

You need to make sure that the /forum directory is set up as an application in IIS. Your web page is currently looking for the /bin folder in the /intranet directory, but it is probably under /forum/bin.

If you have any other questions, start a new topic outside of this one.
brucehanson


Newbie


Join Date: 4/4/2007
Posts: 4

Posted: 4/5/2007 5:02:16 PM

I got it fixed by reading a previous thread.
Thanks!
This is a great product!

Hank-Ahn


Newbie


Join Date: 4/16/2007
Posts: 3

Posted: 4/16/2007 2:45:26 AM

I have a web application that uses asp.net 2.0 membership and roles. Is it possible to automatically create a new user when they create a new user in my web application? Also is it possible to automatically log them into the forums when they log in to my web application?

grimmeissen


Administrator


Join Date: 8/30/2005
Posts: 656
Location: Cincinnati, Ohio

Posted: 4/16/2007 9:15:35 AM

This tutorial explains all of the variables that need to be set in order to automatically log someone into DMG Forums.

What you could do is just copy an entry into the DMG_MEMBERS table that matches any of the important information from your members table and give it a dummy password. Then, when users log in to your site, just set the session variables properly and they will be logged into the forums.

The link below also shows a solution that was created by one of the members here and seems to be pretty popular.

http://www.dmgforums.com/topics.aspx?ID=43
   Page of 3 Next »    Last »


  Copyright DMG Development DMG Forums 3.2