How do I deploy a theme to a SharePoint site? - sharepoint

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?

Related

Deploy a .aspx page to the Sharepoint 2010

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.

Kentico Not Showing Added Pages from Visual Studio 2010

I am working with Kentico in Visual Studios (web project) on my local computer. When I add folders or files to the solution and then run it in the browser, the pages do not show up in the CMS desk or site manager. Am I creating these folders/files in the wrong place in the solution (ex: {directory of web project}/CMSPages/filename.aspx)? Or maybe have incorrect settings?
This is not the way how it works - the system has no idea about your pages if you place them on the file system. However, you can create ASPX page templates and then use then for the documents. Please see the Devnet forum
Best regards,
Juraj Ondrus
Where Do you want to use this page?
In the visitor sites or CMS Page
If you want to use visitor site you can create a webpart and add you webpart to the Page create on content tree.
If you want to use in the cmsdesk the you need to register your page in the module

Sharepoint Foundation master pages on subsites

Using Sharepoint Foundation 2010 I've edited v4.master, added a ref to a new CSS file, saved the changes and they are applied to the home site no problem.
However when I create a subsite it uses the old version of v4.master for some irritating reason. I'm vaguely aware that some of the publishing features from SPS are not included in SPF so lots of the online advice isn't relevent (?)
If there is a way to make new subsites inherit the new V4.master I'd be very grateful.
This is only possible with a custom WSP or an HttpModule, both requiring .NET code. The Server versions of SharePoint handle this easily with the Masterpage option, a quick google search for "foundation masterpage solution" gave good results, including:
http://blog.thedesigndrifter.com/?p=1112
http://rickhilferink.wordpress.com/2011/01/25/creating-a-sharepoint-2010-foundation-masterpage-solution-and-automatically-activate-it-for-all-sites-and-newly-created-subsites/
If you'd like the ability to have a master page at the site collection root inherited by subsites, then you are best off using a publishing site template.
You can then go to: /_Layouts/ChangeSiteMasterPage.aspx and specify your custom master page, and have it inherited by all subsites.
this is probably too late to benefit you, but maybe it will benefit others. I have found that if you do not rename the customized master page to something other than v4.master, then subsites will not inherit the customized version of v4.master but use the original uncustomized v4.master instead. So make sure that you make a copy of v4.master and rename it. Here are some steps from [my blog post], this is how i did it:
Right-click on v4.master and select ‘Reset to site definition’ and the original v4.master will be restored, and SPD 2010 will automatically create a v4_copy(1).master page (screenshot 14).
Check-in custom.master, publish a major version, and approve the file
Go to Site Actions > Site Settings > Master Pages and select the new master page, custom.master, for both Site Master Page and System Master Page, and select the checkbox for ‘Reset all subsites to inherit this alternative CSS URL’ (screenshot 15)
Now if you have forgotten to activate the publishing feature for you new subsite with the Team Site template, it will not inherit the custom.master page yet, so go to Site Actions > Site Settings > Manage site features and activate the publishing feature (screenshot 16)
As soon as the feature is activated you should see the new master page and its styles (screenshot 17)
I solved this problem by creating new a custom site defintion by Visual Studio and SharePoint Site Definition. I added a feature which adds my custom masterpage (edited from
v4.master) into site collection's masterpage gallery (_catalogs/masterpage):
<Module Name="MasterPageModule" RootWebOnly="FALSE" List="116" Url="_catalogs/masterpage" >
<File Url="mymasterpage.master" Path="MasterPageModule\mymasterpage.master" IgnoreIfAlreadyExists="TRUE" Type="GhostableInLibrary">
<Property Name="ContentTypeId" Value="0x010105"/>
</File>
The main thing to get the same masterpage for all sites is to set MasterPageFile -property in Default.aspx like this:
MasterPageFile="~sitecollection/_catalogs/masterpage/mymasterpage.master" - this refers always to rootsitecollection level.
I think that same thing can be achieved by using FeatureActivated-method, but it didn't worked in my case, don't know why.

Port ASPX page to Sharepoint

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.

Creating asp.net membership pages 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.

Resources