Customization of Portal with SharePoint Part II: Deploy Custom Application Page

Previous: Customization of Portal with SharePoint Part I: Deploy your own Web Part

In the previous post I wrote about deploying custom Web Parts on top of Portal with SharePoint. Many times creating Web Part is not enough and you want to have an entire page dedicated to the functionality you may want to add. If you have worked with SharePoint you would be aware of Application Pages and their usefulness. Just like Web Parts Application Pages share the session items and claim items with Portal with SharePoint, making it possible to build your business driven page for Student/Staff/Employer. Since, Application Page deployed in SharePoint will have its own URL you can add it to Portal’s navigation as an External Link.

In this section we will talk about some of the possibilities once custom Application Page is deployed on Portal with SharePoint.

Step 1: Create Application Page

You can create and customize an Application Page by adding Application Page item to any SharePoint Project and then editing the code file for the page. This article from MSDN has steps for creating and deploying custom Application Page:

https://msdn.microsoft.com/en-us/library/ee231557.aspx

Application Pages are standard .aspx pages and you can embedded any control or .ascx files just like you do on ASP.Net website.

Step 2: Add custom code for Application Page

Similar to what we did in Part I, we will assume that we have a service returning today’s class schedule for logged in student and we want to display the result in this page. Good thing about having Application Page co-deployed with other Portal with SharePoint component is you have access to all the Session and Claim items. So, your Application Page does not have to worry about where and how to get StudentID or it does not have to worry about authenticating the user. Your Application Page will be about the business functionality you want to add. In this example I am using the StudentID from session.

Step 3: Deploy Application Page to Portal with SharePoint

As you may know, as of today Portal with SharePoint is supported on both SharePoint 2010 and SharePoint 2013. In order to seamlessly support multiple SharePoint versions the Site Collection created for Portal with SharePoint runs under SharePoint 2010 mode even in SharePoint 2013. It is important to deploy the application page so that it can be consumed. You will have to use PowerShell script to achieve this deployment. Once you generate the necessary package file (WSP) from your solution you need to run following command to deploy the package.

Step 4: Test your Application Page

Once the Page is deployed properly you can navigate to the URL of the Page and test your functionality. You can even attach debugger and debug the behavior of the page if you wish.

Portal Application Page with Default Master

Step 5: Master Page and Layout

When you test your Application Page you will notice that the theme, layout, navigation, etc. look just like Portal. This is because the Application Page is using the Default Master Page, which is configured with all the necessary layout and theme of Portal with SharePoint. Notice following line from ASPX page.

You can use the same Master Page or you can decide to deploy custom Master page with custom layout if you wish. If in case you want to display this page as part of External Link then you can use SharePoint’s out of the box minimal Master Page. All you have to do in your Application page is modify the DynamicMasterPageFile property from Page directive above.

Download

All the samples shown in this Part II and previous Part I are available for download. The ReadMe.txt has information about the content of solution and deployment.

Download Sample

-tushar ~tas

Leave a Reply

Skip to toolbar