Click here to Skip to main content
15,884,629 members
Articles / Productivity Apps and Services / Sharepoint
Tip/Trick

How To Add Custom ASP.NET Page Using Layouts Folder Approach in SharePoint2010

Rate me:
Please Sign up or sign in to vote.
5.00/5 (2 votes)
9 Jan 2012CPOL2 min read 47K   3   1

Introduction


Layout Folder approach is one of the methods of integrating files into Share Point Site. This document explains the steps for adding Custom asp.net Pages to _layout folder using Layout Folder approach.

Advantages


Following are the advantages when we add Custom Aspx Pages into Share Point Site

  • End users can perceive all those pages within SharePoint site. She/he must not go to a separate web application URL.
  • No additional Work needs to be done once the integration is done.
  • Share Point Security and access rules will take care of everything.
  • No additional Authorization and Authentication mechanism needs to be done.
  • Development Efforts are less compared to developing Web Parts.

Solutions


Following are few solutions in which we can integrate Custom Aspx Pages into Share Point Site

  1. SharePoint designer approach: This approach is better when we work with few aspx pages and less functionality.
  2. Web Parts approach: This can be used in combination with SharePoint designer. But once again, developing many web parts is not
    feasible solution and sometimes leads to performance issues.
  3. _Layouts folder approach: This is best and simple method of all. This method deploys the web application pages under the _layouts folder of Share Point Site and the pages can be accessed from any Share Point Site.

Steps


Following are the steps how to add Custom aspx or asp.net Pages in Share Point Site

Step 1: Open Visual Studio 2010 and create an Empty Share point Project named as "AspxToLayouts"



Step 2:Select "Deploy as Farm solution"

Step 3 Right click on the Project and add navigate to "Add -> SharePoint 'Layouts' Mapped Folder."





Step 4: After adding, Layouts folder structure will be generated in your project. After that we will add our newly custom aspx page to the Layouts folder that got generated in our project. Sometimes we can add existing Aspx also if required.

Step 5: Hence to add a new aspx page, Right click on your custom folder "AspxToLayouts" and click on "Add -> New Item" Following, In Add new item menu under “General” tab select “Text file” and rename it as "MyPage.aspx" See the screen shot below



Step 6: Now your Project structure should look something like below screen shot.



Also, in the above screen verify the “Deployment Path” for newly created Page. To verify Traverse to "MyPage.aspx" -> Properties window.

Step 7: Next, in solution explorer right clicks the Project and Build & Deploy.

Step 8: Once it is deployment is done successfully, traverse to your 14 hive folder and validate that new folder "AspxToLayouts" generated with our custom page “MyPage.aspx” in it.

References



  1. Getting started with SharePoint Server 2010
  2. Learning SharePoint
  3. Google India
  4. Bing

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
QuestionHow to set the application Page as welcome page Pin
gurmeetkaur200727-Aug-12 20:26
gurmeetkaur200727-Aug-12 20:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.