Tutorial: Running ASP.NET applications under Community Server

Summary

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. 

DotNetSlackers has been kind enough to publish my article. You can find it here.

Published Tuesday, October 24, 2006 5:45 PM by Tod Birdsall

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

 

Community Server Daily News said:

news of the day a grab bag for what's happening in Community Server Sean Winstead seamlessly adds forums

October 27, 2006 3:35 PM
 

Tim Laughlin said:

Thanks for the nice resource, take the guess work out for the rest of us. Tim
October 28, 2006 10:35 AM
 

Announcements said:

This week... Announcing the Windows Vista Team Blog, the new and improved blog of the Windows Vista Team

October 28, 2006 7:10 PM
 

Life, Universe and Everything according to Dirk said:

All I wanted was something simple: I would like to have an asp.net 2.0 application "qml" beneath my Community

October 31, 2006 4:31 AM
 

J-O Eriksson said:

Didn't see this article until today. Just wanted to say that I think it's a great and very useful post!
November 2, 2006 4:52 PM
 

Coroebus said:

Hello, can you provide us an example solution, I have so many errors ... Thanks a lot
November 3, 2006 12:00 PM
 

breezback said:

I get this error:

ASPNET: Make sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class (e.g. Page or UserControl).

Any help?

:)

November 5, 2006 9:53 AM
 

breezback said:

What I really need is a tutorial to see how I can use UserControls from CS in this new Default.aspx within my site (under CS application).

Any ideas how to use them?

Thanks :)

November 5, 2006 9:57 AM
 

breezback said:

solved it inheriting from CommunityServer.Components.CSPage

like this:

public partial class _Default : CommunityServer.Components.CSPage

{

   protected void Page_Load(object sender, EventArgs e)

   {

       CommunityServer.Components.User currentUser =   CommunityServer.Components.CSContext.Current.User;    

       Label1.Text = currentUser.Username;

   }

}

November 5, 2006 10:08 AM
 

dmwc said:

November 5, 2006 9:25 PM
 

Tod Birdsall said:

Breezback,

Thanks for sharing the solution. I will try it out.

November 6, 2006 9:23 AM
 

Alan said:

Cool - just what I was after, also had the same error above, and inherited it like breezback said, but in vb: Partial Class Players Inherits CommunityServer.Components.CSPage
November 10, 2006 11:27 AM
 

Ben said:

I got the following error (c:\inetpub\itatennis is the location of my virtual directory for my app). Any ideas? Directory 'c:\inetpub\itatennis\Languages' does not exist. Failed to start monitoring file changes. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Web.HttpException: Directory 'c:\inetpub\itatennis\Languages' does not exist. Failed to start monitoring file changes. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [HttpException (0x80070002): Directory 'c:\inetpub\itatennis\Languages' does not exist. Failed to start monitoring file changes.] System.Web.FileChangesMonitor.FindDirectoryMonitor(String dir, Boolean addIfNotFound, Boolean throwOnError) +398 System.Web.FileChangesMonitor.StartMonitoringPath(String alias, FileChangeEventHandler callback, FileAttributesData& fad) +767 System.Web.Caching.CacheDependency.Init(Boolean isPublic, String[] filenamesArg, String[] cachekeysArg, CacheDependency dependency, DateTime utcStart) +2560 System.Web.Caching.CacheDependency..ctor(String filename, DateTime start) +118 System.Web.Caching.CacheDependency..ctor(String filename) +56 CommunityServer.Components.ResourceManager.GetSupportedLanguages() +120 CommunityServer.Configuration.CSConfiguration.get_DefaultLanguage() +19 CommunityServer.Components.CatastrophicMessage.Write(HttpContext context, CSException csException, String filter, String errorFile) +26 CommunityServer.Components.SiteUrls.Instance() +673 CommunityServer.Components.CSUrlReWriter..cctor() +18
November 20, 2006 7:39 PM
 

Tod Birdsall said:

Hi Ben,

This error can be solved by copying the Languages directory from the CS application to the root of your application. In your case it would be 'c:\inetpub\itatennis\Languages'. If you are getting this error, you will probably need to copy the Themes directory from the CS application to the root of your application as well.

November 21, 2006 10:00 AM
 

Ben said:

Tod, thanks for the prompt reply :) Now i have a new error: Community Server expects to find a valid XML file containing all of the links for a community. By default, this file is located at the root of the with the name SiteUrls.config. A common error is to included unescaped XML characters, such as "&" when defining a querystring. If available, the location of the error will be listed below: Exception has been thrown by the target of an invocation. The type initializer for 'CommunityServer.Components.ApplicationSet' threw an exception. CommunityServer.Blogs.Components.WeblogApplication, CommunityServer.Blogs Would love to get my app running under cs asap.. Any ideas? Thanks!
November 21, 2006 4:51 PM
 

Ben said:

(see last post) sometimes loading the same page gives: [ThreadAbortException: Thread was being aborted.] System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck) +0 System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache) +103 System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache) +261 System.Activator.CreateInstance(Type type, Boolean nonPublic) +66 CommunityServer.Components.SingletonProviderHelper.LoadInstance(String ProviderKey, Type defaultType) +141 CommunityServer.Components.UrlReWriteProvider..cctor() +64 [TypeInitializationException: The type initializer for 'CommunityServer.Components.UrlReWriteProvider' threw an exception.] CommunityServer.Components.UrlReWriteProvider.Instance() +0 CommunityServer.CSHttpModule.ReWriteUrl(HttpContext context) +13 CommunityServer.Components.CSContext.Create(HttpContext context, UrlReWriterDelegate rewriter) +50 CommunityServer.CSHttpModule.Application_BeginRequest(Object source, EventArgs e) +361 System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +92 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
November 21, 2006 4:56 PM
 

Ben said:

Ok, figured out the answer to my post above - just needed to include CommunityServer.Blogs.dll...
November 21, 2006 6:07 PM
 

Daily News Faq List said:

Very useful A-1 Prime Time Tutorial from Tod Birdsall on Running ASP.NET applications under Community

November 22, 2006 10:03 AM
 

Steve Collins said:

Make sure you sync the connection settings from the /cs/Web.config with the new virtual directory Web.config (for connection settings). In the example above this would be myCS/Web.config -and- vicious/Web.config I also copied the LANGUAGES folder from the original folder (myCS/Languages) to the new virtual directory (viscious/Languages) for a lack of something better to do. It generated an error for Languages so I fixed it. I also removed all references from my project and re-referenced all of the DLL files in the BIN directory in myCS folder. (/cs/ for the rest of us).
December 11, 2006 9:52 PM
 

Grant said:

Hi, Thanks for your article. I have some probelm when I followed your teaching. Actually It works when I test it on my local machine(XP). But it makes an error on the live server something like below. Exception information: Exception type: TargetInvocationException Exception message: Exception has been thrown by the target of an invocation. When I access the default.aspx file of application under CS, the error is "The page cannot be found " Thanks.
December 17, 2006 11:03 PM
 

RAFAL FURDZIK said:

How to do this the other way? My application i in root, CS is a subfolder...
January 2, 2007 9:18 PM
 

FAQs - Communityserver.Org said:

FAQ posts contain multiple subject items appropriate to this forum, and will evolve over time with new

January 9, 2007 10:39 PM
 

Rafael Nenninger said:

I'm in the same situation as Rafael Furdzik. How do you have an application in root and cs in subfolder. I followed the steps : referenced the dlls, copied the config files (although I copied them to the root of my app, cs is in my "forums" folder). When I run this code on a page in the root folder (after logging in in CS) CommunityServer.Components.User csUser = CommunityServer.Components.CSContext.Current.User; csUser is an Anonymous user Thank you for your time
January 13, 2007 7:06 PM
 

Community Server said:

This week... Announcing the Windows Vista Team Blog, the new and improved blog of the Windows Vista Team

January 19, 2007 9:53 PM
 

gstadter said:

In the "how to" article, the newly integrated app is accessed by browsing "to the /vicious subdirectory that contains your Default.aspx page".    Do you know of any tutorials on how, for example, to actually integrate it into the site so that it a)has its own tab on the navigation bar and b)loads below the nav bar, not taking over the whole page?

January 24, 2007 12:18 PM
 

Will said:

Thanks for the great article. Any idea how to get this to work with the Atlas/Ajax controls? I can get everything to work as you describe and I can get an an Atlas/Ajax page working but as soon as I put the two together the ajax page does a full postback in the CS environment. I think it has to do with changing the line public partial class _default : CommunityServer.Components.CSPage to referr to the CS page vs the System.Web.UI.Page. Without the change though, as you know, it won't work at all. Thanks again, Will
February 11, 2007 2:27 PM
 

Tod Birdsall said:

Hi Will,

I have successfully used the Anthem.NET AJAX toolkit alongside Community Server.

http://anthemdotnet.com/

For my purposes, it worked well.

I have not done much with the "Atlas"/ ASP.NET AJAX framework.

February 12, 2007 12:55 PM
 

Will said:

I realized my mistake. I had not loaded the AjaxControlToolkit.dll into the "host" CS site's bin dir. I had left it in the bin dir of the "add-on site". I also needed to move all of the related refs from the "add-on's" web.config into the web.config of the CS "host" site. Thanks for the Anthem suggetion. Nice toolkit for sure. I wish I'd known about it while I was waiting around for Atlas/Ajax to be finalized.
February 15, 2007 12:59 PM
 

Community Server Bits said:

Very useful A-1 Prime Time Tutorial from Tod Birdsall on Running ASP.NET applications under Community

March 12, 2007 7:30 AM
 

pj said:

i'm trying to incorporate this article into my site. Any chance you can show step 4 in VB as opposed to C#? Thanks.
March 29, 2007 5:10 PM
 

pj said:

I created a page using C#, but I get this error: The ConnectionString property has not been initialized Which is the same error I get via a VB page............any thought?
March 29, 2007 5:58 PM
 

Community Server said:

Here is a good reference for Running ASP.NET applications under Community Server that I didn't want to

April 8, 2007 3:47 PM
 

Mahendra said:

Hi Tod!! I tried in my local system but could not got the result after copying the required directory from CS web directory to my application root folder it displays the CS home page instead of apllication defaukt.aspx page...
August 6, 2007 6:18 AM
 

Jens said:

Hi Tod! I am stuck at the same point as Methendra. Maybe this has to do with the new CS version? Can anybody help me or point to a new source to solve this problem? Thank you very much, any help is highly appreciated.

January 17, 2008 7:52 AM
 

Waqar said:

Hey Tod, Great job man!! :)

Your tutorial really helped. The Q&A section on your page is great too... I resolved all the issues from your and readers' responses!!

Cheer!

February 10, 2008 5:29 AM
 

技術論壇 said:

June 11, 2008 11:54 AM
 

tyuy said:

ytutut

September 23, 2008 9:31 PM

Leave a Comment

(required) 
(optional)
(required) 
Submit