I'm trying to port an existing ASPX page, which is part of an existing web site, into a new Sharepoint site. The ASPX page is a relatively simple form with some server-side controls, the ability to email form submissions and "Captcha". The current website has the Newtonsoft.CaptchaControl dll registered in the bin folder. So what I need to do is:
Port the ASPX page into the proper location within the content of a Sharepoint site
Properly register the CaptchaControl dll with Sharepoint and link allow the ASPX page to utilize it
Set up application page
The ASPX page would be called an 'application page' in SharePoint. You can copy the ASPX to the layouts folder under the "12 Hive". ("%CommonProgramFiles%\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS"). It would then be accessible from any SharePoint site under {URL}/_layouts/CustomPage.aspx (e.g. http://site/_layouts/CustomPage.aspx or http://site/subsite/_layouts/CustomPage.aspx).
Add safe control entries
It looks like you know to place any DLL for your aspx page as well as CaptchaControl.dll in the bin folder for the SharePoint site under IIS. The DLLs must be signed with a strong name key. You also need to add the strongly-named signature of the DLLs to the SafeControls list in the web.config file for the SharePoint site. If you open up the web.config you'll see examples, e.g.:
<SafeControl Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
Namespace="Microsoft.SharePoint" TypeName="*" Safe="True" />
Configure code access security
Assuming your controls actually do something, you need to mark them as trusted in the Code Access Security file that SharePoint uses. Change the trust level in web.config from WSS_Minimal to WSS_Custom. Go to "%CommonProgramFiles%\Microsoft Shared\web server extensions\12\CONFIG" and copy wss_minimaltrust.config to wss_customtrust.config. Edit wss_customtrust.config and make new CodeGroup entries using the public key of your DLLs. For example:
<CodeGroup
class="UnionCodeGroup"
version="1"
PermissionSetName="FullTrust">
<IMembershipCondition
class="StrongNameMembershipCondition"
version="1"
PublicKeyBlob="002400000480435694000000060200000024245452534131000400000100453261002888e278243eb86b47eea4be1b23451177126fb9c847085e66e895a64b148c675dabda94d9301f4886a0126887bcd067356affb16a5112baf3198525fc96c45f4178a6263e1a1132bb6c0a4cdaeaccd97b0d4ab42139585700c41e8481feff03e13f30bb0a10ffa7746770d144be94954b7a908fb9bb680ebe611f50f6db" />
</CodeGroup>
Note: This will make your DLLs fully trusted within the SharePoint web application. It is better practice to restrict permissions to those actually required.
Related
I am new to sharepoint and have a scenario
1) I have a aspx page which displays some data from a xml.
2) The data is populated in a table in the aspx page using a code behind .cs file.
3) I use some dll's which I have made to access the data.
Note:- This things are done on my local pc which does not have a sharepoint server installed.
Now my question is
1) I want a way using which I can use this page as a webpart in a sharepoint site.
2) Can you please guide me a by which the compiled dll of the web application can be used as webpart.
Note:- I have access to put files on the server but cannot develop anything on that
You can use the User Control in SharePoint and add it to your site page..
OR
Use Visual Studio and create an empty SharePoint project (deploy as farm solution).
Then, right click project and add mapped layouts folder.
Rename this folder to whatever name you want to appear (this folder will get created on the servers layout folder in the hive) after you deploy the solution.
Add your aspx page and cs into this folder
Then, double click on package.package (its inside package, above layouts folder, under project)--> Advanced --> Add (existing assembly) and add your dll references here.(this will add the dlls under your sites sharepoint web.config.
After deploy, you can access page using: http://sharepointsite/_layouts/foldername/youraspxfilename.aspx
Let us know about the progress.
In a sharepoint site with code behind, when I publish from wsp everything works but if I paste de aspx file directly on my website from the SharePoint designer I get the "Could not load the assembly, make sure that it is compiled before accessing the page alarm".
Do you know why is that?
This is my first line in the aspx:
<%# Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="RPC.SharePoint.Calcula.Default,RPC.SharePoint.Calcula,Version=1.0.0.0,Culture=Neutral,PublicKeyToken=613479fcd4366789" %>
and this is my class:
namespace RPC.SharePoint.Calcula
{
public partial class Default : System.Web.UI.Page
{
I'm guessing that the codebehind is joining the logic to the aspx so maybe I have a problem in the inherits sentence...
Any ideas? Thanks
SharePoint does not allow you to use page with code behind. You have to compile your code to assembly first. Sign your assembly and make it fully trusted by either deploy in GAC or register in your SharePoint web config.
If you deploy your solution in wsp file. The steps above are done automatically. But if you use SharePoint designer, you have to do that step manually.
I've got a SharePoint 2010 feature that I'm upgrading to SharePoint 2013. In 2010, I'm creating a virtual directory in IIS for a theme that my site uses. The theme consists of a .css and a .skin file in an App_Themes virtual directory on the site's root. I create the virtual directory through a feature activation routine.
In 2013, I'd like to eliminate the creation of virtual directories. Ideally, I'd like SharePoint to host what was in my App_Themes virtual directory. Is there a way to do that? In 2010, creating the App_Themes virtual folder enabled me to use this theme in the web.config pages element like this:
<pages enableSessionState="false" enableViewState="true" **theme="DefaultTheme"** enableViewStateMac="true" validateRequest="false" pageParserFilterType="Microsoft.SharePoint.ApplicationRuntime.SPPageParserFilter, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" asyncTimeout="7" enableEventValidation="false" viewStateEncryptionMode="Never">
Is there a way for me reference a theme in the web.config without creating a virtual directory for my site?
Is there a reason why you don't use SharePoint Theming engine in SP2013?
You could create your own custom theme and apply it on site using custom feature. I wrote a few blog posts on the topic few months back: http://blog.dragan-panjkov.com/archive/2012/09.aspx.
Let me know if this answers your question?
I have a Custom Action on the Site Settings page of my SharePoint site that appears in the UsersAndPermissions list. It is created using a feature, this is the elements.xml file for the feature:
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction
Id="SDITeamGroupApplicationPage"
GroupId="UsersAndPermissions"
Location="Microsoft.SharePoint.SiteSettings"
Sequence="1000"
Title="Create a Team Group">
<UrlAction Url="_layouts/SDITeamGroupEdit.aspx"/>
</CustomAction>
</Elements>
Currently all the users of site can see this link on the Site Settings page. I want to be able to restrict who can see this link. Is this possible? How can it be done?
http://msdn.microsoft.com/en-us/library/ms460194.aspx
Look for the elements called "Rights" and or "RequireSiteAdminstrator" etc.
Here are the list of possible "Rights":
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spbasepermissions.aspx
You can create a visual studio solution which uses CustomAction for such requirements.
Here is the step by step instructions to build a visual studio solution which adds new custom link in site settings page: Add a Link to Site Settings Page in SharePoint.
We have some asp.net pages that include the asp.net membership user controls for forms based authentication and would like to make use of these in a SharePoint MOSS environment.
Can anyone suggest the best place to deploy these and the best method for deployment, I was hoping to use solution packages to deploy them to the root of the site.
Appreciate any feedback
A good technique I've used previously is to make a copy of the standard SharePoint login page and make changes to that. There is an article by Damon Armstrong that describes how to do this. His article is good apart from making a copy of the _layouts folder which I believe is overkill. You can just put your amended copy of login.aspx and login.master in its own folder under LAYOUTS in the "12 Hive". Then configure ASP.NET to use these custom files with this directive in the FBA site's web.config:
<system.web>
<authentication mode="Forms">
<forms loginUrl="/_layouts/CustomFBA/login.aspx" />
</authentication>
</system.web>
As the custom pages are going under the Layouts folder they should be trivial to add to a solution file.
This sounds to me like a good candidate for an Application Page, deployed to the 12\TEMPLATE\LAYOUTS folder. MSDN has a Visual How-To here: Creating an Application Page in Windows SharePoint Services 3.0. At a minimum you would need to set your master page to ~/_layouts/application.master and deploy the assembly with your WSP.