Add asp.net pages into sharepoint - asp.net

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.

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.

asp.net: updated pages compilation

I need to ensure that when some individual pages are updated/modified, the time required to load the other pages to the Web site remains unaffected.
A. Create the application as a Web site project.
Copy the entire application to the deployment server.
Copy only the updated files to the deployment server when a page is updated.
B. Create the application as a Web site project.
Pre-compile the application by using the update able option.
Copy only the updated files to the deployment server when a page is updated.
is Pre-compile option available for web site or its available for web app?
I can simplify this question by some ifs that contains your answer.
If you update just the ASPX files and rarely you change the code files : then
Use Website and publish it using
Allow this precompiled site to be updatable
Using this option you can change ASPX files
Use fixed naming and single page assemblies
Using this option you can change code files, and replace them with their friendly name
Update required published dlls and ASPX files when ever you need.
Note: any changes to bin folder contents may cause application restart and that means all sessions will be lost, so in this case you must consider using other session state modes like SQLServer and StateServer and once you do you need to annotate all your session classes with Serializable attribute
If you will update just the ASPX files : then
Use Website and publish it using
Allow this precompiled site to be updatable
Using this option you can change ASPX files
Else if you just need to update the ASPX HTML content : then
You might reconsider your application scenario
because you need to use data-base to rectify the update problem as any body else do
And finally if you will update web-site code-files very rarely or your changes are at application level rather than page level : then
Use web-application build or publish it if you like.
Using this option you still have the ability to change the ASPX files

How register a subclass of a web control in an ASP.NET website?

I would like to subclass an ASP.NET control, like UpdatePanel, and use the subclass in my web site. I know if I move the code to a separate assembly I would be able to reference the assembly from within Register phrase but I wonder if there is a way to keep all the code inside the website.
Would appreciate to have your help.
Sure, you can put code files in App_Code if you are using the web site project template, or if you are using the web application project template, the code can be within a folder in the web site.
Note that the name of the assembly in web site project templates is App_Code, and for web app projects its the name defined as the assembly name in the project settings.
Do you know which template you are using?
When it comes to custom controls, sometimes you may run into issues, especially if you want to change the existing behavior of updatepanel.
HTH.

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.

Resources