Create a simple hello world custom Application Page in SharePoint.
· Create a new default.aspx page rename it to HelloWorldAppPage.aspx
· Put the following markup in it
· Every application page is an content page in SharePoint. And here to have same look and feel as the other application pages we have specified the application.master as the masterpagefile.
· Inherits attribute of the Page directive refers to LayoutsPageBase class from which the application pages inherit.
· We have than used a content server control that would be referring to the PlaceHolderMain content place holder inside the application.master page.
· Than we have simple added a label control that would be displaying hello world.
· Now go to your 12 hive i.e. C:Program FilesCommon FilesMicrosoft Sharedweb server extensions12TEMPLATELAYOUTS and create a folder (MyHelloWorld) over there and put the HelloWorldAppPage.aspx over there.
· We could have directly placed the aspx page to layouts folder but than from better organization perspective we have created a folder and kept the aspx page inside it.
· Now the page is available to all the SharePoint sites.
· The easiest way is to first create a Asp.NET Web site project.
· Add a class library project to the solution (GCL)
· Delete class1.cs and copy the default.aspx.cs page from asp.net web site project to the class library project.
· Delete the default.aspx.cs from the website.
· Add reference to System.Web and Microsoft.SharePoint.dll in your class library project
· Put the following code in the _Default
· Sign the assembly and put it in GAC.
· Get the public key token.
· In the default.aspx page replace and put the following markup to use the assembly.
· Put default.aspx to the layouts folder or your custom folder inside it.
Posted in SharePoint Tagged: SharePoint
This was originally posted here.

Like
Report
*This post is locked for comments