You might be wondered what interesting requests you can get. One request i got was to create an application page which does not show the ribbon, the navigation, just nothing but an upload form for a SharePoint document library. The user should not see that he is uploading a file to a SharePoint library and that he is not working on SharePoint.
Sounds easy, but the important thing was to be able to use SharePoint Context and its features in Code. So today i show you how to create this application page which has nothing inside but the possibility to use all SharePoint features.
Step 1: Add an application page to your project into the layouts folder
I name it creazyPage.aspx.
Step 2: Customize the application page
There are some important to do’s:
At first go to your creazyPage.aspx and delete all Placeholders.
That means the following Placeholders: PageHead, Main, PageTitle, PageTitleInTitleArea.
Then delete the DynamicMasterPageFile in the <%@ Page Tag.
Then add the following line before the <%@ Page Tag:
< %@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=18.104.22.168, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
You are almost ready. If you deploy now your solution you should get a white page. So let’s proceed.
Now add your content. Start with
<head> <title>creazyPage</title> </head> <body> <form id="creazyPage" runat="server"> //[[ Here you can add your code like asp Controls or other Controls]] </form> </body>
Step 3: Deploy your solution
You solution should now look like this:
A cool trick:
Now if you add asp-Controls you see that you won’t get suggestions which controls are available. If you are smart, then you create your application page in the normal way till it is working as you want it to work . After that you just do the necessary changes described in step 2 and you’re done.
..:: I LIKE SHAREPOINT ::..