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,
Fig – (1) 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 see in figure – (1) file path is “c:\chirag\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 – (2) 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.
<SafeControl Assembly=”FirstWebProject” Namespace=”FirstWebProject” TypeName=”*” />
Fig – (3) Safe Control Tag.
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 <trustLevel> tag in share point sites’s web.Config file. You need to set trust level to “WSS_Medium”
<trustLevel name=”WSS_Medium” policyFile=”C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\config\wss_mediumtrust.config” />
Fig – (4) Setting Trust Level.
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.
Happy Programming !!!