我試圖首次創建SharePoint Web服務器上的自定義asp.net網站,我已經創建了下面的Default.aspx在SharePoint _layouts文件夾中創建自定義Web應用
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" MasterPageFile="~/_layouts/application.master" %>
<%@ Assembly Name="Microsoft.SharePoint.ApplicationPages,Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<asp:Content ID="Content1" ContentPlaceHolderId="PlaceHolderMain" runat="server">
<div>
Title of this site: <asp:Label ID="LabelTitle" runat="server" Text="Label">
</asp:Label>
</div>
</asp:Content>
<asp:Content ID="Content2"
ContentPlaceHolderId="PlaceHolderPageTitleInTitleArea" runat="server">
Test ASP.NET 2.0 Application
</asp:Content>
與下面的默認.aspx.cs
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Microsoft.SharePoint;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
SPWeb web = SPcontext.Current.Web;
LabelTitle.Text = web.Title;
}
protected override void OnPreInit(EventArgs e)
{
base.OnPreInit(e);
SPWeb web = SPContext.Current.Web;
String strUrl = web.ServerRelativeUrl + "/_catalogs/masterpage/default.aster";
this.MasterPageFile = strUrl;
}
}
我也是在web.config中註釋掉,而我包括Microsoft.SharePoint.dll的作爲項目的引用。然後我刪除了_layouts \ TestWebsite \
下的整個文件夾。但是,當進入http://server/_layouts/TestWebSite/時,出現'文件未找到'錯誤。有什麼我失蹤或我應該跳過的設置?
謝謝。