How To Create Custom Application Pages In SharePoint 2013

Introduction

An application page is a web page that is used in a SharePoint website. An application page contains content that is merged with a SharePoint Master page. A master page enables application pages to share the same appearance and behavior as other pages on a SharePoint site. We can create application pages in Visual Studio by adding an Application Page item to a SharePoint project. In this article, I will explain how to create Application Page in SharePoint 2013, using Visual Studio.

Pre-Requisites

  1. Open Visual Studio.

  2. Open New Project dialog box. Expand Office/SharePoint node and then choose SharePoint Solutions.

    Solutions

  3. Choose the SharePoint 2013 – Empty Project template. Name the project as CustomSharePointProject.

    Solutions

  4. Choose the "Deploy as a farm solution" radio button (because Application Page will work only in farm solutions) and click Finish.

    Solutions

  5. “CustomSharePointProject” SharePoint project got created.

    Solutions

Create Application Page

  1. Right click on CustomSharePointProject -> Add -> SharePoint “Layouts” Mapped Folder.

    Solutions

  2. Layouts Mapped Folder got created with the following structure.

    Solutions

  3. Right click on “CustomSharePointProject” folder under Layouts ->Add -> New Folder.

    New Folder.

  4. Name the folder as “Pages”.

    New Folder.

  5. Right click on “Pages” folder ->Add -> New Item.

    New Folder.

  6. Add Application Page (Farm Solution Only) from the Add New Item window. Name it as “CustomPage.aspx”.

    New Folder.

  7. Application Page got created in the following folder structure.

    New Folder.

  8. Open CustomPage.aspx file and add the control fields we want in Application Page from the Toolbox panel.

    Application Page

  9. Open CustomPage.aspx.cs file and write the C# code behind function for the event receivers.

    Application Page

  10. Build and deploy the SharePoint solution.

  11. Our Page will be present in following folder.

    C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\TEMPLATE\LAYOUTS\CustomSharePointProject\Pages

    Application Page

  12. Open the SharePoint site and open the CustomPage.aspx page. /_layouts/15/CustomSharePointProject/Pages/CustomPage.aspx

  13. Our control gets added to the application page. We can check the master page enabled application pages to share the same appearance and behavior as other pages on a SharePoint site.

    behavior

Summary - Thus, you have learned how to create Application Page in SharePoint 2013, using Visual Studio.