Sharepoint with ASP.Net Web Application - asp.net

What I need to do is create a web application that can run inside SharePoint. It needs to be more involved then a web part and include many pages and a database. I know you can create a SharePoint application that goes under the Action bar, but I would like to create something that is run like how a site is. I would want a few tabs to show different sites, each running the same application, just showing their own data.
It looked like creating a site definition would be the best route to achieving this, but I have not been able to get it to become like an ASP.Net Web Application. Anyone know of any other project type or method that can be done to develop an ASP.Net Web Application that simply shows up in SharePoint? I know I can do it in a page viewer webpart, but that just seems like a cheap hack to create an IFrame and not the optimal solution. I don't need any true integration with sharepoint, other then using it for Authentication and a display mechanism. Our corporate intranet is setup using SharePoint, so anything that I build has to exist within it.
If anyone has any guidance, I would love to hear your suggestions.
Thanks!

It's actually pretty straightforward, at the basic level:
Create your ASPX pages with codebehinds in your own assembly - just like normal.
Use the Sharepoint master pages (look at the existing ones to mimic their styles and markup)
Create a Feature which adds a link to your "entry point" page(s) to the SP menu
Deploy your assembly to the GAC

Related

I can't find options for Select Master Page or Place code in separate file in VS2012

I installed VS 2012 on my work PC, and for the life of me when I go to add a new web form, I cannot see or find the 2 options for Select Master Page or Place code in separate file.
Any ideas on how i can find them?
I've just been fooled by just that for the past hour. What I've found is that the 'old' method of using the menu option 'Add web page using master' (or similar) has vanished, and been replaced by 'Content Page'. When you select this, you're then given the option of choosing a master page.
Incidentally, I don't get the option of starting a web site project, which may be why I'm not seeing this either.
You should have web form with master page in the add items?
Placing code in separate file is a different concept called code-behind. You will have an ASPX file and a cs / vb file which handles the events.
e.g.
Default.aspx
Default.aspx.cs
EDIT: Based on comment.
You may be using a Web Site on your laptop, but a Web Application in work. See Web Application Projects v's Web Site Projects.
Take a look at ASP.NET Web Site or ASP.NET Web Application?, this might also help in deciding which to use. Generally, I always go for Web Application.
You can use VS to convert from a Web Site to a Web Application, but AFAIK, you can't do it the other way round unless you create a new project and copy across the relevant parts - which could be a big job depending on the size of the site.

Using SPWebPartManager and Sharepoint WebParts in standard ASP.NET page

I have a server with WSS 3.0 installed and a functional team site. But I want to build a series of pages on a seperate site that are standard asp.net 2.0 type pages but include web parts and will display some summary information and links back to the WSS site (like to the documents). The pages will be added to an existing site that will not be converted to a WSS site.
I have attempted to include the SPWebPartManager (and WebPartZones) to the page but am getting a "Object reference not set to an instance of an object." even though I have done the "Register Tagprefix="SharePoint" on the page and included the Microsoft.Shareoint reference in the project.
Does anyone know where I can get a minimal environment for a page to do this type of thing?
Thanks
you know asp.net has it's own web part manager. http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.webparts.webpartmanager.aspx
although what it sounds like to me you are trying to do is simply read documents from a sharepoint list. In which case you dont need sharepoint web parts you just need to call the sharepoint web services.

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.

Add asp.net pages into sharepoint

How to add or open the asp.net pages from inside sharepoint?
I found many info on the web about that, but they all fail or they are not clear. I appreciate your help :)
Your question is not clear, but if you want to customize look'n'feel of SharePoint page you should use SharePoint Designer.
In case you want to create some additional functionality from scratch the easiest way is to create a custom web part and then add it to a SharePoint page.
I think you want to include an aspx page to call either using an AJAX include or to be able to use the MOSS Object Model without having to add references etc?
if so then the following steps are necessary:
navigate to 12\layouts\
create a folder for the asp.net files
put the inline code files in
From sharepoint you can add a page viewer web part and reference it with the following url _Layouts//Filename.aspx
This technique will only work with inline code, if you wish to compile your code then you would create the site as normal and then add an application folder within the virtual directory of that particular site for example my site is called intranet:
navigate to c:\inetpub\wwwroot\wss\intranet
add your asp.net folder to this as a sub folder
in inetmgr right click the folder and create an application for it (use the same app pool as the sharepoint site)
ensure ALL DLLs from the sharepoint site bin folder exist within the apps bin folder or it will throw an error.
However, I would only ever use these methods as proof of concept and would ultimately use web parts, custom features and workflows to carry out the same functions.

How to store an ASP.NET master page in a common library?

We would like to have several internal web applications which use the same master page. Is there a way to store a master page in a common library referenced by all projects?
You can do this, but it is difficult and has quite a few drawbacks.
This process is similar to packaging up user controls as well. Basically you have a web application project that contains your master page. You can precompile this into a set of dlls using aspnet_compiler.
then you can use ilmerge.exe to put them all into a single dll that you then reference from your other projects.
You still need to have the markup in order for your pages to render properly in the designer, so you'll probably have to investigate VirtualPathProviders as well.
It's a kludgy solution and it has many drawbacks.
I've heard this works, I haven't tested it.
Create a separate project to house your master pages, since all master pages are like user controls and built into their own separate assembly. Run the build and try referencing the assembly of the master page.
Again, not tested, just something I've read before.
G'luck with it!
Given that these modules are part of the same web application, you should look at this approach:
Basically, you have one root web, which is set up as the(only) IIS web application.
You may plug in new web modules by creating ASP.NET Web Application projects and place under the root web, physically.
Set the build directory to root web's bin, eg. "..\bin". Don't create a IIS application/virtual directory.
Thereby, each web module compiles into its own DLL, which is itself a good thing.
When compiling, it is "merged" with the root web.
It is a great way for sharing master pages and user controls, and have different parts of the web site in different projects/assemblies.
Master pages and user controls will even work in design mode.
Hope this helps
Sharing master page across the application
Enjoy.. :)

Resources