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 !!!
Hi I just read your article on ” add aspx page to sharepoint” 2007″ and its great and I got it to work. Now I am struggling with a page that connects to a remote sql server that wont display and wondered if you had any other articles that take this a step further for connecting to db’s and using classes in the web appplication. I am getting all sorts of errors and any help would be appreciated.
Thank You Very much
HI
Thanks for the article has helped me a lot, keep up the good work.
Regards
Lance
[url=][/url]
Hi Chirag,
ur article is good and working, want to know how to handle events in aspx page which conected to sharepoint
I like snowflakes.
I have done this and it works great except that i get a Website requires you to login error when trying to view the page. I want it to be anonymous access.
hi chirag
super article.i think this will b the most simplest method!!!!
very good work man .KEEP IT UP!!!!
Found your site in google, and it has a lot of usefull information. Thanx.\
It works, thanks.
I have add a simple button on te aspx page and now it gives te following error:
“System.Security.SecurityException: That assembly does not allow partially trusted callers”.
Many websites gives de following tip:
Add the following code to the AssemblyInfo.cs file:
using System.Security;
…
[assembly: AllowPartiallyTrustedCallers()]
But it doesn’t help.
I used the GAC to get around the web.config updates but I keep getting “Unknown Error” no matter what I do. There is absolutely no code in my app at this point. Does anyone know what could be causing this? Does it not know to look in the GAC for the dll? Do I need some special declarations at the top of my aspx file? Please help me hate sharepoint less
U should check it in webconfig safecontrol
Looks like I forgot a for my GAC dll. I’m back to “Access Denied” now. I kinda thought the whole GAC thing would get around that but I guess I forgot god hates me
Hi,
The post was very good and I was able to add a custom aspx page without any difficulty. However I would like to raise and issue here. Suppose I have a dataset having table adapter connected to a remote server. I am using this dataset and table adapter to populate values on to my page and then validate and save it back to table. Can I do this in this manner? When I tried I got error. I copied the ds file also to the folder where I have custom aspx. Where can I add my custom connection string?
Hi Chirag,
When I entered into your blog thru Google search, first I impressed with Banner there after I gone thru the article. Nice pic…..keep it forever.
Cheers
PC Rao
I dont think its an appropriate solution.It is not adding a page in sharepoint site.It is juts trying to add a page on that port.
Here we are accessing the page without Sharepoint site address.
This is a great idea, but what about when you need to access data within the production SharePoint site? How do you access that data directly using the object model if you are not on the server?
Hi.. your post was really helpfull.. it worked out properly. but instead of aspx web controls i tried using dev express controls.. but now it failed. the application works well with dot net but when trying to view via share point, it isnt working on. can you please on me out on this..
Thanks and Regards
Malathy.L.
hi ,
i made website in .net without database (only read content) in this website aspx and aspx.cs pages also images and css files available i want integrate all this website in to sharepoint how to integrate this website to sharepoint site
this is very urgent…
thnx
hi ,
i made website in .net without database (only read content) in this website aspx and aspx.cs pages also images and css files available i want integrate all this website in to sharepoint how to integrate this website to sharepoint site
this is very urgent…
thnx
Thank you so much. Link was really helpful. Do you know how can i add custom themes to .aspx page?
Hi Chirag,
ur article is good and working,
want to know how to handle events in aspx page
& page that connects to a remote sql server if you had any other articles that take this a step further for connecting to db’s and using classes in the web appplication.
Visit my blog
Not suitable for sharepoint. This is simple aspx page, you cananot use sharepoint functionalities within this page.
title should be Add aspx page to website(not SharePoint 2007)
How to create wsp file from this ?
I was very pleased to find this site. I wanted to thank you for this great read!! This is a very informative post, it helps me more.
Hi chirag,
I read your article and i tried but it is not working it is showing errors . In my aspx page i dont have the any code how to separate the code from my page and place into bin can you please help me.
Regards,
Nagaraju A.
Hi,
My name is Sam I am developing the program like your blog my solution have 4 projects actually I read the book named ‘Workflow and SharePoint-Going with the flow’ I try to do 4 forms-Association, Initiation, Modification and Content type task form. I copy dll to bin directory and add safecontrol like you I can open association form,initiation form and modification form but when I click to open task form it has error occur. I check again and again but I make sure that I do step by step it cannot open. Pleas advice me.
thanks
sam
Продам участок 12 соток рядом с морем. Гос.акт, асфальт.подъезд, 1-я линия (150 метров) от моря – Килийский район, с.Приморское. Цена 2000 у.е за 1 сотку. Есть варианты.
Карта _http://spytnic.cyperb.com.ua/ukr/18-odobl/629-primorscoe.html
Продам высококачественную быстросохнущую краску для металоконструкций
Срочно Дешево г.Днепропетровск, ОПТОМ. Дмитрий 0950300572