Thursday, June 25, 2009

Adding Custom Pages .aspx To Sharepoint

How To Add Custom aspx pages to SharePoint 2007


This post will show how to create aspx (web page) page to SharePoint 2007. You can find a really good article to add custom page in SharePoint 2007 site. I have shown one approach describe in above article.

Create a new Web Application Project from Visual Studio 2005. You need to download web application project extension for this. Open Visual Studio 2005 and select Web Application Project as shown below,



Create new Web Application

Name the project “FirstWebProject”. Delete Default.aspx page and add new Web Page and name it to “FirstCustomePage.aspx”. You can design this page as you want. Once you are done with designing run the application once to make sure that there is no error.

Now go to the file path where you have created the Web Application. Here in my case as you can file path is “c:\subbu\VortalProject”. You have to copy the DLL file from web application’s BIN folder to share point site’s BIN folder. To Find BIN folder for your share point site, go to IIS and select your share point site. Right click on the site name and click on Open.



Fig – (1) Locate BIN Directory for SharePoint Site.

This will open physical location where you site resides. Copy web application’s DLL file (In my case “FirstWebProject.dll”) in BIN directory of SharePoint site.

Now create a new folder at same level where your SharePoint site’s BIN directory resides. Name is “CustomePage”. Add the “FirstCustomePage.aspx” page to “CustomPage” folder.

Open Web.Config file of Share Point site and copy safe control tag shown below to Web.Config file.
Safe Control Tag.

<safecontrol assembly=”FirstWebProject” namespace=”FirstWebProject” name=”*”></safecontrol >



If you have chosen different namespace and assembly names than you have to use your name instead of this. You have completed 90% of the task.

The last thing is, you have to add tag in share point sites’s web.Config file. You need to set trust level to “WSS_Medium”

Setting Trust Level.

<trustlevel name="”WSS_Medium”" policyfile="”C:\Program" common="" microsoft="" web="" server="">

Here you have completed all the required configurations !!!! Now open your share point site in browser and check for newly added page. In our case the link will be

http://ServerName:PortNumber/CustomePage/FirstCustomePage.aspx


If you have done all the changes as mentioned above you can see your page running fine in browser.







No comments :

Post a Comment