Add aspx page developed in Visual Studio to sharepoint

Hi folks

Can you tell me if this is even possible.....

I have an aspx page which I have made in Visual Studio. It basically has a web form with the usual objects which are populated from a database. Now... I want to have this page within my sharepoint site, so I want to add a link to it on the sharepoint home page and when the link is clicked I want the page to load and look like all the other pages (i.e. with the sharepoint menu at the top, etc...

Is this possible, and if so how? The closest I have got is adding a web page, modifying it in front page and inserting my page into an IFrame, which I am not really happy to do.

Any suggestions?

PS.... if this is not possible I would love to hear suggestions as to how to work around this.

Thanks

Will

[803 byte] By [WillBuchanan] at [2007-12-29]
# 1
I suppose it is possible but you would at a mimimum need to use SharePoint's master pages to get the proper look and feel. As a work around you can use the Page Viewer Web Part to point to where the existing page resides.
GaryA.Bushey at 2007-9-5 > top of Msdn Tech,SharePoint Products and Technologies,SharePoint - Development and Programming...
# 2

Hi

Many thanks for the reply.

Where can I get the sharepoint master page from?

I'll take a look at the Page Viewer.... i've never heard of this before so i'll dig around.

Thanks again.

Will

WillBuchanan at 2007-9-5 > top of Msdn Tech,SharePoint Products and Technologies,SharePoint - Development and Programming...
# 3

I'm not very sure but u can try adding the following line on top of ur aspx code.....this will bring the Master content to your page.....

<%@ Page language="C#" MasterPageFile="~masterurl/default.master" Inherits="Microsoft.SharePoint.WebPartPages.WebPartPage,Microsoft.SharePoint,Version=12.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Import Namespace="Microsoft.SharePoint" %> <%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

the problem I see here is that this aspx page is not in SQL express....and master is there so might not work....the best u can do is place your web page inside your sharepoint web application. Create a new Page using Sharepoint Designer which will automatically link your new page to Master....the add a web part called Page viewer and link this web part to your aspx page....

-Manu

Manuk at 2007-9-5 > top of Msdn Tech,SharePoint Products and Technologies,SharePoint - Development and Programming...
# 4

This is real easy to do using a Feature:

In SDK check out "How to: Provision a file" using <Module Path="SubDirInFeatureDirWhereFileResides" Url="WhereYouWantYourFilesToGo"><File Url="FileName.aspx" Type="Ghostable" /></Module>

Adding sharepoint master is also simple. Just add a page directive in the top that 1) adds master and 2) adds SPDesigner support:

<%@ Page MasterPageFile="~masterurl/default.master" meta:progid="SharePoint.WebPartPage.Document" %>

Now you need to add all content placeholders defined in master (or master will fail)

<asp:Content ID="title" runat="server" ContentPlaceHolderID="PlaceHolderPageTitle">

Title goes here

</asp:Content>

<asp:Content ID="addhead" runat="server" ContentPlaceHolderID="PlaceHolderAdditionalPageHead">

<!-- custom meta data goes here -->

</asp:Content>

<asp:Content runat="server" ContentPlaceHolderID="PlaceHolderMain">

Content goes here

</asp:Content>

Look in the SDK about adding a feature using STSADM.exe

hth

AndersR

AndersR at 2007-9-5 > top of Msdn Tech,SharePoint Products and Technologies,SharePoint - Development and Programming...
# 5

Hi.

Thanks to all for replying.

AndersR: Thanks for your lengthy reply, but being totally new to this i'm not sure I can follow it! I have read "How to provision a file" in the SDK but that just had some xml examples which didn't make any sense.... where do I put the xml (does it go into a file somewhere?), etc. Also, I don't actually know what file i'm supposed to be provisioning!

Also, I tried adding the "<%@ Page MasterPageFile..." thing to an aspx page but I just got an error about "The file '~masterurl/default.master' does not exist".

I looked up stsadm.exe in the help, but as it seems to do everything I wasn't sure which part of it to look up!!

As you can see, I have got no idea about any of this so would really appreciate if you could help!

Thanks

Will

WillBuchanan at 2007-9-5 > top of Msdn Tech,SharePoint Products and Technologies,SharePoint - Development and Programming...
# 6

Hi Manuk

Thanks for the reply. As you guessed, the master page code didn't work!! I have looked at using PageViewer but this leaves an ugly scroll box within a scroll box which made my pages hard to use.

Thanks

Will

WillBuchanan at 2007-9-5 > top of Msdn Tech,SharePoint Products and Technologies,SharePoint - Development and Programming...
# 7

Just a thought. Another approach would be to port your code to a WebPart that you can insert into any existing (or new) page in your sharepoint site.

http://msdn2.microsoft.com/en-us/library/ms452873.aspx

Guejón?rnTorsteinsson at 2007-9-5 > top of Msdn Tech,SharePoint Products and Technologies,SharePoint - Development and Programming...

SharePoint Products and Technologies

Site Classified