Integrating Web Application into MOSS

Integrating Web Application into MOSS

Introduction

This document gives the technical steps required to follow in order to port a web application built on .net to Microsoft Office SharePoint Server 2007.

Overview

Purpose:

To give technical overview on how to port a Web Application developed using .net (c#/vb.net) to Microsoft Office SharePoint Server 2007 and to enable the smooth integration, build and debugging.

Assumptions:

Web Application is created as a Web Application project in Visual Studio and is convertible. New Web site option in Visual Studio does not support this integration.

Development Environment

  • Microsoft Windows 2003
  • Visual Studio 2008
  • SQL Server 2005
  • Microsoft Office SharePoint Server 2007
  • Microsoft Office SharePoint Designer 2007

It is due to the reason that flow-mediated vasodilation of the arteries of penis is improved and it becomes easier to get and maintain an erection. order tadalafil This helps sustain http://davidfraymusic.com/events/international-platonov-arts-festival-voronezh-russia/ buy cialis online the erection of a man until he achieves orgasm, thereafter the operate regresses. Still tadalafil uk price providing the same intimacy with your partner. Impotence is a common issue and all of us are usually aware of it. levitra prescription

Application Architecture:

An ASP.Net based web application will be ported into MOSS site. Web Application will use Microsoft.Sharepoint namespace to access the context and security information from its parent MOSS site. Same can also be used to facilitate uploading and reading documents from the MOSS Site’s Document Library.

MOSS Web Application Integration

Implementation

  1. In MOSS, Create a new Web Application using the Central Administration.
  2. Using Visual Studio 2008 create a new ASP.Net Application project.
  3. Specify a namespace for the applicaton.
  4. Add reference to Microsoft.Sharepoint
  5. Remove all references except: Microsoft.SharePoint, System, System.Web and System.Data if required
  6. In the Solution Explorer create folder “~masterurl” and add a masterpage named “default.master” inside the folder
  7. Replace code behind for the masterpage with the following:
    using System;
    using Microsoft.SharePoint;
    namespace ItDoesWork._masterurl
    {
    public partial class _default : System.Web.UI.MasterPage
    {
    protected void Page_Load(object sender, EventArgs e){}
    }
    }
  8. open default.master page in the designer, rename ContentPlaceHolder’s ID to “PlaceHolderMain”
  9. Replace Page directive of each aspx page in the web application with the following:
    <%@ Page Language=”C#” MasterPageFile=”~masterurl/default.master” CodeBehind=”<pagename.aspx.cs” Inherits=”<namespace>.<pagename>” Title=”<title>” meta:webpartpageexpansion=”full” meta:progid=”SharePoint.WebPartPage.Document” %>
  10. Delete the <header> tag and its contents
  11. Delete <page> and its </page> tag
  12. Delete <form> and its </form> tag if any.
  13. Enclose the page content within
    <asp:Content ID=”Content5″ ContentPlaceHolderID=”PlaceHolderMain” runat=”server”>
    </asp:Content> 
  14. In the Project properties page, cahnge Build – Output path to point it to \BIN folder of our SharePoint Web application. E.g. C:\Inetpub\wwwroot\wss\VirtualDirectories\avanade-intranet:80\bin.
    You can also manually copy your projects DLL into the \BIN folder each time.
  15. Compile your project.
  16. Open the web.config file for the SharePoint Web Applicaiton E.g. C:\Inetpub\wwwroot\wss\VirtualDirectories\avanade-intranet:80\web.config
  17. Add the following line to the SafeControls section
    <SafeControl Assembly=”<namespace>” Namespace=”<namespace>” TypeName=”*” />
  18. Add the following Page parse path
    <PageParserPaths>
     <PageParserPath VirtualPath=”/*” CompilationMode=”Always” AllowServerSideScript=”true” IncludeSubFolders=”true” />
    </PageParserPaths>
  19. Change the <trust level=”WSS_Minimal” originUrl=”” /> line to <trust level=”WSS_Medium” originUrl=”” />
  20. Save web.config file
  21. Open your site in SharePoint Designer and drag and drop your Web site’s aspx pages from Windows Explorer into a folder in your SharePoint site.
  22. Browse to your page E.g. http://fire-corp:80/TestApp/TestPage.aspx

MOSS Context Integration

In order to access Parent SharePoint site’s context from the web page, reference Microsoft.SharePoint library and add ‘using Microsoft.SharePoint’.

You can now access the context information using c# code.
e.g.
lblSiteURL.Text = SPContext.Current.Site.Url;

You can also access SharePoint Document Library.
e.g. SPSite oSiteCollection = SPContext.Current.Site;

SPWebCollection collWebsites = oSiteCollection.AllWebs;
SPDocumentLibrary oDocumentLibrary = (SPDocumentLibrary)oList;

SPListItemCollection collListItems = oDocumentLibrary.Items;

Debugging

To debug the site, attach w3wp process to the Web Application.