Tags

First, create a Class Library project in vs 2005/2008.
Add Microsoft.SharePoint dll reference

Create a file called HelloWorld.aspx

<%@ Assembly Name="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%> 
<%@ Page Language="C#" MasterPageFile="~/_layouts/application.master" 
         Inherits="Microsoft.SharePoint.WebControls.LayoutsPageBase"  %>

<%@ Import Namespace="Microsoft.SharePoint" %>

<script runat="server">
  protected override void OnLoad(EventArgs e) {
    //SPWeb site = SPContext.Current.Web;
    SPWeb site = this.Web;
    lblSiteTitle.Text = site.Title;
    lblSiteID.Text = site.ID.ToString().ToUpper();
  }
</script>

<asp:Content ID="Main" contentplaceholderid="PlaceHolderMain" runat="server">
  <table border="1" cellpadding="4" cellspacing="0" style="font-size:12">
    <tr>
      <td>Site Title:</td>
      <td><asp:Label ID="lblSiteTitle" runat="server" /></td>
    </tr>
    <tr>
      <td>Site ID:</td>
      <td><asp:Label ID="lblSiteID" runat="server" /></td>
    </tr>
  </table>       
</asp:Content>

<asp:Content ID="PageTitle" contentplaceholderid="PlaceHolderPageTitle" runat="server">
	Hello World
</asp:Content>

<asp:Content ID="PageTitleInTitleArea" runat="server"
             contentplaceholderid="PlaceHolderPageTitleInTitleArea" >
	The Quintessential 'Hello World' of Application Page
</asp:Content>

or you can create a sepeate cs file but add code into you

  • Sign a strong key and build the project.
  • Add the assembly into GAC
  • Then Copy the HelloWorld.aspx to C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\Test
  • so now if you go to your site and add/_layouts/Test/HelloWorld.aspx, it should show the page

    Advertisements