Published: 16 Apr 2007
By: Tod Birdsall

In this article you will learn how to successfully setup your own ASP.NET 2.0 application to run as a virtual directory under the Community Server 2.1 website.

Introduction

I have been working with Community Server for some time now and most of my installations require that Community Server integrates with existing applications. This article will walk you through the process of setting up your own ASP.NET application under the Community Server installation.

Step 1: Setup your Community Server website

There are multiple ways to complete this step. For the purposes of this article, I will assume that you have downloaded the Community Server 2.1 (Web Install) - ASP.NET 2.0 package and followed their instructions on setting up a database. I will also assume that you placed the Community Server web directory at C:\myCS\web.

Create a new website called myCS in IIS and point it to the home directory of C:\myCS\web.

Step 2: Create your Web Project

Open Visual Studio 2005 and create a new website project. Be sure to give it a creative name like "del.icio.us" or "Delicious_Library". Seeing that those names are already taken I will call the example project "vicious". I will assume you created this project under C:\viciousProject\viciousWeb.

Add the following references to your newly created web project:

  • CommunityServer.ASPNet20MemberRole.dll
  • CommunityServer.Components.dll
  • CommunityServer.Reader.dll
  • CommunityServer.SqlDataProvider.dll
  • CommunityServer.Blogs.dll

The above files can be found in the C:\myCS\web\bin folder. Adding the above files as references will pull in all dependant DLL's. If you now look in the C:\viciousProject\viciousWeb\bin folder, you will notice that several other DLLs have been added automatically, in addition to the four indicated above.

Copy the following files from the root of your CS website (C:\myCS\web) to the root of your web project:

  • communityserver.config
  • SiteUrls.config

Step 3: Create the Virtual Directory

Open IIS and browse to the Community Server site you just created (myCS). Right click myCS to open the context menu. Click on New > Virtual Directory.

At this point a helpful Virtual Directory Creation Wizard window should display. When prompted, type vicious for the alias, browse to C:\viciousProject\viciousWeb, and set the Access Permissions to allow Read and Run Scripts.

Step 4: Add some Community Server code

Let's add some code to your web project that will give us a quick taste of what we can do with an app that is properly configured to run as a virtual directory of a Community Server site.

If your web project did not automatically create a Default.aspx file in the root of the project for you, then you should create one now. Open the Default.aspx webform and add a Label control to the page. Next, open the Default.aspx.cs and add the following code to the Page_Load function.

The above code will display the username of the currently logged in user when the page loads. For this to work properly, your application's authentication mode must be set to "Forms" in your Web.config. The line should like similar to this:

Step 5: View Frankenstien's Monster

Browse to your functioning (hopefully) Community Server 2.1 web site. After you have logged in, browse to the /vicious subdirectory which contains your Default.aspx page. Once the page finishes loading, you should see your Community Server username displaying on the page.

Summary

In this article you have seen how to create an asp.net application under the Community Server application. I hope that you are able to use this article to assist you with harnessing some of the features of Community Server in your own ASP.NET 2.0 applications.

<<  Previous Article Continue reading and see our next or previous articles Next Article >>

About Tod Birdsall

Like many software developers, my love of video games kindled an interest in programming. I eventually realized that playing games and writing code for games are two completely different things and have resigned myself to business application programming. I enjoy writing and sharing knowledge wit...

View complete profile here.

Other articles in this category


jQuery Mobile ListView
In this article, we're going to look at what JQuery Mobile uses to represent lists, and how capable ...
JQuery Mobile Widgets Overview
An overview of widgets in jQuery Mobile.
Code First Approach using Entity Framework 4.1, Inversion of Control, Unity Framework, Repository and Unit of Work Patterns, and MVC3 Razor View
A detailed introduction about the code first approach using Entity Framework 4.1, Inversion of Contr...
jQuery Mobile Pages
Brian Mains explains how to create pages with the jQuery Mobile framework.
Exception Handling and .Net (A practical approach)
Error Handling has always been crucial for an application in a number of ways. It may affect the exe...

You might also be interested in the following related blog posts


My History of Visual Studio (Part 8) read more
Adding users to a TFS project when youre not on the domain read more
Web Deployment Tool has gone RTW read more
Multi-Targeting Support (VS 2010 and .NET 4 Series) read more
PHP Linux Windows ASP.NET Performance Redux ! read more
Understanding Reverse Proxy Servers and the Mailman read more
Session State Not Working? Check Your Web Garden! read more
Three IIS Concepts ASP.NET Developers Should Know read more
Moving MOSS Intranet to a New WFE read more
Enterprise Architecture Meta-model, size doesn't matter read more
Top
 
 
 

Please login to rate or to leave a comment.

Free Agile Project Management Tool from Telerik
TeamPulse Community Edition helps your team effectively capture requirements, manage project plans, assign and track work, and most importantly, be continually connected with each other.