In this post you will learn how to create an application page in SharePoint 2013 using visual studio 2012.
You will create these pages when you want to use it as a common page for all the applications in your server. These pages are shared across all the sites on the server.
Application pages can customize with different controls in the asp.net. You can add the specific master page as well to these pages.
If you want to debug the page, you will follow the normal approach like debugging your webparts.
Let's start ..
Open visual studio 2012, click on new project select SharePoint solutions under the office/SharePoint from which select project type as SharePoint 2013- Empty Project.
Enter your project name, here it is "Application".
Click OK. It will open the wizard to create the project.
Select the site where you want to deploy the page. "Http: //dvlabapp01".
Select Deploy as a farm solution and click on Finish to create the project for this application.
To add the page go to [add] [New Item] and select the Application Page (Farm Solutions only). Enter your application name and click Add.
This is the nice way of representation in Visual studio 2012 that it specifies whether the component works only with Farm solution or both Farm as well as Sandbox solution.
Once you have added the page the project structure will show as below screen shot.
Whenever you add the page the structure will get created automatically. I.e. Page will get added to the layouts folder by creating a folder with project Name, in this case it is "Application".
You can add all the controls in the FirstApplication.aspx.
Please see the below lines of code for aspx page.
You can write the logic in .cs file and deploy the solution to the site. After you deploy the solution you can browse the file "_layouts/15/application/firstapplication.aspx" in this example.
In this article you have learned how to create an application page in SharePoint 2013 using visual studio 2012.
Do you want to learn more about SharePoint Online Development? Click the image below and enroll in the FREE course.
Devendra Velegandla is a five-time recipient of Microsoft's Most Valuable Professional (MVP) award (2014-2019) for Office Apps and Services, Office Servers and Services MVP and SharePoint Server. He received the MCC award for his contributions in Microsoft MSDN/TechNet forums. He loves sharing articles, videos, and tutorial on SharePoint and Office 365.