How to add custom ASP.NET pages into sharepoint - asp.net

How to add custom ASP.NET pages into sharepoint?
I am very new to sharepoint but what I realized is that I can only make plain text pages or links. but what if I have a website already built in ASP.NET and want to add it through sharepoint.
Or is it possible to build the website itself from sharepoint including dynamic server side controls like buttons, trees ....

Simple answer: put your *.aspx files in inside the _layouts folder, usually located at
c:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\
afterwards you can access you page (named page1.aspx for example) through the sharepoint site by:
http://your site name/_layouts/page1.aspx
You can have inline code and/or code-behind, just like in a normal aspx page.
However, please note that pages added through this method are called application pages, meaning that they cannot be customized (easily) by the user and are available under all site collections in your farm.
SharePoint supports another kind of pages, called Site Pages which are site-specific, you can read more about them here.

See these questions which should cover everything you need:
How would you convert an ASP.NET site to work as a SharePoint site?
Moving from custom ASP.NET application to Sharepoint Services
Deploying custom Asp.net applications to same IIS site as Sharepoint
SharePoint - ASP.Net Controls Integration
Sharepoint controls in ASP.NET application
Also this page on SharePoint Dev Wiki.

This Visual How To walks you through the process of creating an application page step by step.
Creating an Application Page in Windows SharePoint Services 3.0
http://msdn.microsoft.com/en-ca/library/bb418732.aspx
The presenter of the video, Ted Pattison, has a book that is a great resource to help you get up and started with SharePoint development.
Inside Windows SharePoint Services 3.0
http://www.amazon.com/dp/0735623201?tag=g6consulswebs-20

If you want some .aspx-Pages in a SharePoint-Website, you can build a SharePoint-Module Feature containing the .aspx-Pages.
See How to: Provision a File and Create and Use a SharePoint Feature Package

Related

How to get SharePoint Site authentication information to use it in an ASP.NET website which is integrated inside that SharePoint Site?

I have integrated my ASP.NET website into a SharePoint Site by using an IFrame in the SharePoint Page via a Content Editor Web Part. The ASP.NET web application doesn't have any authentication & authorization implemented in it.But the SharePoint site is having some authentication implemented. Now my requirement is how to get and use that SharePoint authentication information in my ASP.NET web application programmatically to do some code manipulations based on the authenticated user level.Any help would be appreciated.Thanks in Advance
The 'Right' way of doing it would be to redevelop your site as a collection of Application pages. This allows you to limit permissions to Site Collection Administrators, or just about any level of SharePoint Authentication.
http://msdn.microsoft.com/en-us/library/Ee231581(v=vs.100).aspx
This allows you to use the SharePoint object model directly in your 'web' application.
It's a bit complicated to shift from a traditional web application to getting all the pieces running under the Sharepoint _layouts folder, but its worth the time spent and pretty easy to update.
It should be noted that your existing IIS website would be removed and the pages re-homed to that layout folder, via a SharePoint Feature containing your application pages.

Developing Website partially in Sharepoint and ASP.NET

Can I develop a part of the website using Content management System(i.e Sharepoint) and few other sections using core ASP.NET ?
Yes you can. A sharepoint website can contain asp.net pages and run them. Just build your web app and put the asp.net pages in a directory that can be accessed by your site, create the pages in sharepoint using the aspx files and put the dll file your app spits out in the bin directory of your sharepoint site.

How do I deploy an Asp.net web application to a Sharepoint 2010 site using WSP

Suppose I created a custom web application that consists of:
several assembly DLLs: web app, business logic, data services
multiple aspx pages and ascx custom controls that use them
custom configuration section
custom HTTP module
More or less the usual stuff.
I would like to deploy it to a particular sharepoint site under a certain subfolder. So if I access my sharepoint site via http://myserver:90/ (because I'm not using sites/some_site) I'd like my application to be available under http://myserver:90/webapp
I could manually add a virtual folder (not application because I would need to access some Sharepoint site's data) to my sharepoint site in IIS and manually edit site's web.config file to register my HTTP module and add my custom configuration section as well either putting my DLLs into GAC or put them in the _app_bin (so I don't have problems with CAS), but I don't think that's a good thing to do, because this web application may get deployed in an environment where this shouldn't/couldn't be possible.
So I figured I could build a WSP using Visual Studio 2010 and deploy it that way. But I don't have enough experience doing that.
I created a new sharepoint 2010 project. Is there a way I could add all non-executable application files (aspx, ascx) at once? I've seen the advanced tab of the WSP package where I can add my DLLs either to bin folder or GAC. I don't know whether I would also have to add any safe control and register certain classes?
So I suppose I need some pretty detailed and explanatory guidance here.
The only real way to do this would be to use the layouts folder to deploy your application via the wsp. This will let you depot any files that you would normally deploy with a.web application.
There are couple of problems however. The URL for your application will be http://SharePoint/somesite/_layouts/yourapp
This is a blessing and a curse. Your urls will be ugly but they will work under every SharePoint site. If your application depends on SharePoint context to function, that context will automatically be available based on the requesting URL.
To add a layouts folder under your share point project right click on the project and add a mapped folder to layouts. I would also recommend adding a sub folder under layouts for your application so that your application files don't conflict with the default files directly in the layouts folder.
For the http module, or any web.config modifications, you can use the spwebconfigmodification class.
Heres a walkthru: http://sharepointsolutions.blogspot.com/2006/12/using-spwebconfigmodificat_116736917110571614.html

Using your SharePoint site Master Page on all application pages

I am new to share point. i would like to add custom .aspx pages in share point. this i was able to do it using this blog http://chiragrdarji.wordpress.com/2007/10/12/add-aspx-page-to-sharepoint-2007/#comment-3540 .. now i would to inherit the share point's master page in my asp.net application and implement some controls. can any one help me out regarding this?
thanks and regards
malathy.L.
Using the sharepoint master page in another app is not going to work. It has a bunch of sharepoint specific controls on it that your custom app won't recognize. It is much easier to put all your app's logic (i.e. all controls now in an ASPX page) in a USerControl and use those on ASPX pages in SharePoint.
Then to be able to use these controls you need to do either of these options:
Then deploy either by putting the .ascx files in the CONTROLTEMPLATES folder in SHarePoint's 12 hive and the DLL in the bin folder / Global Assembly cache. If you go for the BIN folder you would probably need to write CAS Policy files though. This is the most secure method.
use the SmartPart.
I'm guessing you are very new to SharePoint , but want to urge you to consider packaging all this up in a SharePoint Solution (a .wsp file) using a tool like WSPBuilder.
Also I would encourage you to read up on SharePoint Development / Deployment Best Practices check out this Checklist.

How to run/debug multiple web application projects with-in the same solution?

I have 2 web application projects. One is my asp.net MVC app and the other is for the admin related functions which is asp.net web forms Dynamic Data. My MVC app would be the main site, but I would want the webforms to work under an Admin folder of the MVC site.
While debugging the application, I would like the "/admin/Default.aspx" link on the MVC site to link to the default page within my Dynamic Data site. How do I accomplish this? I know I can test each project independently.
Within the visual studio project, you can right click on a folder and select "Convert to Web Application" which resolved my issue.
The easiest way would be to run them both in separate virtual directories and use Url Rewriting to push requests for the root to the public site. You can nest ASP.NET applications, but that generally requires quite a bit of fussing with the configuration file to dodge inheritance issues.
You could achieve this behavior via your IIS-Manager. Click on the Website, navigate to the folder you want to behave like a separate application and use right-mouse click and press "convert-to-application".

Resources