Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

In VS2010 I created a new .NET 3.5 solution and inside a new project for SharePoint 2010 (empty project called "SPAppPageTest"); I deployed it as a farm solution. I added a new application page, called CustomApplicationPage1.aspx via add - new item solution explorer menu - I didn't change the page. Here's what my project layout looks like:

enter image description here

I deploy this by right-clicking the project -> Deploy. In directory C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS I can after this see a "SPAppPageTest" folder with a file "CustomApplicationPage1.aspx". However, trying to view the page in browser (Firefox or Chrome) results in "404 FILE NOT FOUND" page being displayed (in IE I get "This webpage cannot be found"). The URL I'm entering is:

http://<server>/_layouts/SPAppPageTest/CustomApplicationPage1.aspx

What am I doing wrong?

Here's how CustomApplicationPage1.aspx looks like (I haven't changed it, it's the default code that VS generates):

<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Import Namespace="Microsoft.SharePoint.ApplicationPages" %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CustomApplicationPage1.aspx.cs" Inherits="SPAppPageTest.Layouts.SPAppPageTest.CustomApplicationPage1" DynamicMasterPageFile="~masterurl/default.master" %>

<asp:Content ID="PageHead" ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server">

</asp:Content>

<asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">

</asp:Content>

<asp:Content ID="PageTitle" ContentPlaceHolderID="PlaceHolderPageTitle" runat="server">
Application Page
</asp:Content>

<asp:Content ID="PageTitleInTitleArea" ContentPlaceHolderID="PlaceHolderPageTitleInTitleArea" runat="server" >
My Application Page
</asp:Content>
share|improve this question
1  
Further to @RJCuthbertson's answer, what is the Site Collection URL the solution is set to deploy to? To find out, click on the SPAppPageTest project, and make sure the properties pane is showing. You want the value in "Site URL". the URL to use to access your page would then be 'http://[Site URL]/_layouts/SPAppPageTest/CustomApplicationPage1.aspx', or 'servername.domain.com/sites/Site1/_layouts/SPAppPageTest/…;, for example. Because it's a layouts page, you should be able to access it from _any valid site collection URL, though. –  Eccentropy Feb 6 at 17:14
    
@Eccentropy exactly :) Any valid site collection will have access to any and all files in the layouts directory in the hive. –  RJ Cuthbertson Feb 6 at 21:33

1 Answer 1

up vote 1 down vote accepted

The first thing that comes to mind is the URL of your site. It appears everything that you've done is correct as far as the project setup and deployment.

The URL of your site needs to be a valid site collection, not just the server name, otherwise SharePoint won't handle the virtual path properly.

So instead of:

http://<server>/_layouts/SPAppPageTest/CustomApplicationPage1.aspx

Make sure that it's:

http://avalidsitecollectionurl/_layouts/SPAppPageTest/CustomApplicationPage1.aspx

Seems like the most likely problem.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.