Let's rokk! [Tudor Cret's blog]

November 13, 2009

Developing ASP.NET web applications with SharePoint 2007 and CSLA.NET(part2)

Filed under: Technologies — Tudor Cret @ 3:50 pm
Tags: , , , , ,

In the first part we have seen which are the requirements for developing an ASP.NET application for SharePoint 2007 and we build a demo application using CSLA.NET. We’ll continue by customizing and deploying the application we’ve created.

Customize ASP.NET application for SharePoint 2007

Before we start it is good to know what is our purpose, what we have until now and what we are going to do :

  • We want to deploy our ASP.NET application created earlier using CSLA.NET on SharePoint 2007
  • We’ll have to use Visual Studio extenstions for Windows SharePoint Services in order to create an Empty project that will help with automatic packaging and deployment to SharePoint Server
  • Link the pages from the Web Application we already have with the newly created SharePoint project
  • Do some configurations on the projects and config files to work with SharePoint

 A good resource about developing custom ASP.NET pages with SharePoint 2007 is Jamil Haddadin’s blog.

We’ll start by creating a new Empty project that I named CSLADemo:

 a6

Figure 5 Creating VSeWSS project

 In this moment the solution contains applications projects and the empty VSeWSS project:

 a6

Figure 6 Solution explorer before customization

The next step requires adding a new web form to the web application MyShop2. I called this web form MyDemo.aspx. It will implement demo functionalities plus some special configurations specific to SharePoint.

 a7

Figure 7 Adding a new web form

 Having created our demo web form a new Module  project item must be added to the CSLADemo project. Also the recent created MyDemo.aspx web will be added to this module. In order to avoid any duplications we’ll add this using Add as link feature. This module is specific to SharePoint and it represents the element through which our custom web forms will be deployed to the server. Be sure that you modify the namespace in MyDemo.aspx.cs, MyDemo.aspx.Designer.cs and MyDemo.aspx to CSLADemo.

 a8

Figure 8 Creating a new module

 a9

Figure 9 Add MyDemo.aspx as link

Now our solution looks like:

 a10

Figure 10 Solution state

 As you it can be observed I  used a key to sign dlls we’ve created earlier: libkey.snk, dallibkey.snk. If not, SharePoint will throw a runtime error. Csla.dll is already signed.  Also these dlls must be added at CSLADemo project, as link, if not they will not be copied to the deployment directory targets.

In  Module.xml a File element has to be included. Update the Path and Url attributes to the file name of the .aspx file. This deploys the page when the SharePoint solution is deployed, in my simple case; the Module.xml will look like:

Path attribute refers to the reference path of the file in visual studio project and URL refers to the URL of the page in the SharePoint site, in this case our page will be deployed here http://ServerName:port/MyDemo.aspx

  a11

Figure 11 Module.xml editing

 In the Configuration Manager of the solution, clear the Build for theCSLADemo check box, see the picture below..

 a12

Figure 12 Build configuration

Add Safe control  entry for each deployed dll in manifest.xml. The file can be found in solution’s WSPview .

 a13

Figure 13 Adding safe controls

 To deploy the solution change the Start browser with URL in the CSLADemo properties page in the debug pane with your SharePoint root site, in my case http://vpc2003/

 a14

Figure 14 Project starting settings

 Before deploying the application and testing it we must comment the SqlDataSource tagMapping in web.config  of the SharePoint application, the web.config associated to http://vpc2003/. It can be found in the virtual directory root.

 a15

Figure 15 Comment data source tag mapping

More about customizing asp.net pages can be found on Jamil Haddadin’ blog.

 Hoping that no errors occur, deploy the solution and test it calling http://vpc2003/MyDemo.aspx

 a16

Figure 16 Running application(1)

 a17

Figure 17 Running application(2)

 The solution is available for download here: http://bitstarsolutions.com/FirstCSLA.rar

Resources:

Advertisements

3 Comments »

  1. […] by Developing ASP.NET web applications with SharePoint 2007 and CSLA.NET(part2) « Let’s rok… — November 13, 2009 @ 3:53 pm | […]

    Pingback by Developing ASP.NET web applications with SharePoint 2007 and CSLA.NET(part1) « Let’s rokk! [Tudor Cret's blog] — November 13, 2009 @ 4:04 pm | Reply

  2. Thanks for sharing the useful information.

    SharePoint also Provides out of the box collaboration features like blogs, wikis, discussions, project management, document libraries, lists etc., that are easy to use and allow information workers to share and manage contents.

    Comment by Allan — December 9, 2009 @ 9:33 am | Reply

  3. Hi,

    This artical is very useful for me. I am a Share Point developer and always looking to learn something new. I would like to introduce another good SharePoint blog, Have a look.

    http://SharePointBank.com
    Harry

    Comment by harry — December 30, 2009 @ 2:40 pm | Reply


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: