Я впервые пытаюсь создать собственный веб-сайт asp.net на веб-сервере sharepoint. Я создал следующий файл Default.aspx
<%@ 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>
со следующим Default.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/ я получаю ошибку «Файл не найден». Я что-то пропустил или пропустил настройку?
Спасибо.