TestAspx1.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestAspx1.aspx.cs" Inherits="TestAspx.TestAspx1" 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>
Page Title: <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>
TestAspx1.aspx,cs
using System;
using System.Collections;
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;
using Microsoft.SharePoint.WebControls;
namespace TestAspx
{
public partial class TestAspx1 : 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 mySite = SPControl.GetContextWeb(Context);
SPWeb Web = SPContext.Current.Web;
this.MasterPageFile = Web.MasterUrl;
}
}
}
Steps I have done to run this webpage under the current sharepoint site.
1. copy the .aspx page on Layout folder (under 12 hive).
2.Give Strong name to the project.
3.Copy the dll into GAC
4.IISReset
5. try to run this page...... http://ost-dclb-shrp/_layouts/TestAspx1.aspx
get the error(shown below)
Error in sharepoint Log
spHttpHandler:GetHash finished
PublishingHttpModule.Init() calling AppDomainUnloadListener.Register()
AppDomainUnloadListener.RegisterSelf() entered lock(this=15368010)
Setting IIS virtual directory path to 'C:\Program Files\Microsoft Office Servers\12.0\WebServices\Root'.
Looking up IIS application pool id 'OfficeServerApplicationPool'.
Creating application 'Office Server Web Application' in application pool 'OfficeServerApplicationPool'.
Setting script maps to '.asax,c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG;.asmx,c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG;.config,c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG'.
Committing virtual directory 'root'.
IIS virtual directory 'root' provisioned on web site 'Office Server Web Services'.
Exception Type: System.Web.HttpException Exception Message: Could not load type 'TestAspx.TestAspx1'.
I am struggleing in this code ...for the last 2 days..Still not get any solutions....Any help will be appriciated......
Thanks,
Anurag