views:

523

answers:

4

Is there a way I can use the sharepoint controls in a ASP.NET web application like any other controls that come out of box for ASP.NET? If yes, what are the pre-requisites I need to install?

Thank you, Harsha

+3  A: 

Yes, you can use SharePoint "controls" in an ASP.NET application, as long as the application is running in SharePoint.

In other words, the prerequisite is SharePoint.

Robert S.
how can we do that?
Ahmad Farid
There are so many nice controls in Sharepoint. It would be great if we can use them outside (in ASP.NET application alone)
Harsha
A: 

What specific controls are you referring to? Those that you find in SharePoint Designer?

If you are referring to Web Parts in WSS v3, those that are using the ASP.NET Web Part as the base web part (the recommended approach) may work fine in ASP.NET since the Web Part class inherits from Panel which inherits from Web Control (going from memory here) - all ASP.Net classes. It would just depend on whether the web part has any SharePoint specific code which is highly dependent upon the web part.

Kirk Liemohn
A: 

Host the application in SharePoint's _layouts directory (see this video for more details). Your ASP.NET app will then be "running in SharePoint" and have access to all SharePoint controls.

Note that some controls don't work unless they are running on an actual SharePoint page.

Alex Angas
+1  A: 

Most controls have internal dependencies on SharePoint (i.e. they use SPContext or SPWeb internally). Also, since they are contained within the Sharepoint Assemblies, you can not just take the .dlls and put them in your app.

In short: In most cases, it will be better to re-build them using reflector. Which one are you looking at?

Michael Stum