1

My application page code

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

while my code file structure

using System;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using HnGTest.DataEntities;
using System.Configuration;
using System.Web.UI.WebControls;
using System.Web.UI;

namespace HnGTest.Pages.Pages
{
    public partial class CustomerCard : Microsoft.SharePoint.WebPartPages.WebPartPage 
    {}

element.xml

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Module Name="Pages" Url="SitePages">
    <File Path="Pages\CustomerCard.aspx" Url="CustomerCard.aspx" Type="GhostableInLibrary"/>
  </Module>
</Elements>

Aspx and cs file within module that solution architexture structure like

enter image description here

but while I deploy I get an error:

"An unexpected error has occurred. "

Update : public partial class CustomerCard :

Microsoft.SharePoint.WebPartPages.WebPartPage 
6
  • 1
    Can you please provide us with more details? Does the error occur when you deploy the WSP, or when you activate the feature? Do you have a message in the logs? An excerpt of the elements.xml file? Is the DLL correctly deployed to the GAC?
    – Evariste
    Dec 16, 2015 at 7:42
  • Feature activated successfully, but while open page from page library error throw and dll file is availabale in GAC folder @Evariste Dec 16, 2015 at 7:45
  • Thanks for these info. There must be a more detailed message: you can get it either from the ULS logs, or directly in the browser if you edit the web.config so it is displayed automatically (see for instance sharepoint.stackexchange.com/a/73798/35604)
    – Evariste
    Dec 16, 2015 at 7:51
  • In ULS log error "UserAgent not available, file operations may not be optimized." and all that web.config setting done as said @Evariste Dec 16, 2015 at 8:03
  • 1
    And no more explicit error in the browser? In the ULS logs you should also have Something more explicit... "UserAgent not available" is a generic error not directly related to your problem :(
    – Evariste
    Dec 16, 2015 at 8:10

1 Answer 1

1

After looking more carrefully at the code-behind, I noticed you inherit from LayoutsPageBase. However, your page is not an application page (inside _layouts), but a module (a file provisionned in a library).
I've never seen a module .aspx page inheriting from it, but always from Microsoft.SharePoint.WebPartPages.WebPartPage. That may be the problem.

3
  • I tried but not worked in my situation @Evariste Dec 16, 2015 at 8:09
  • I update code to class inherit from "Microsoft.SharePoint.WebPartPages.WebPartPage" but this try also failed :(..@Evariste Dec 17, 2015 at 6:18
  • We definitely need a more detailed error message, either by modifying the web.config or from the ULS logs...
    – Evariste
    Dec 17, 2015 at 6:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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