Friday, April 8, 2016

SharePoint injects garbage values at the end of Page Layout

Problem

I have deployed a custom page layout using wsp on the sharepoint. For one of the custom page Layout i was getting an error "Only Content controls are allowed directly in a content page that contains Content controls."

I tried to look for this error in ULS log but didn't get any clue about the actual issue .

I opened the faulty custom page layout in sharepoint designer. And found at end after closing tag of </asp:content>  there was some garbage values. I removed those and again published the layout Error has gone.


Garbage Value was

<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %><html xmlns:mso="urn:schemas-microsoft-com:office:office" xmlns:msdt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"><head><meta name="WebPartPageExpansion" content="full" /><!--[if gte mso 9]><SharePointWebControls:ctfieldrefs runat=server Prefix="mso:" FieldList="FileLeafRef,MasterPageDescription,PublishingPreviewImage,PublishingHidden,_PublishingMigratedGuid,PublishingAssociatedContentType,PublishingAssociatedVariations"><xml>

<mso:CustomDocumentProperties>
<mso:ContentType msdt:dt="string">Page Layout</mso:ContentType>
<mso:UIVersion msdt:dt="string">15</mso:UIVersion>
<mso:PublishingAssociatedContentType msdt:dt="string">;#CDPH Content Page;#0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900BD6A562C8D29B74C8EC78A1D132372B307;#</mso:PublishingAssociatedContentType>
</mso:CustomDocumentProperties>
</xml></SharePoint:CTFieldRefs><![endif]--><title>Content Page – Two Column – Left Navigation</title></head>


Solution

I tried to Digg into the more details for this error and observe the Page Layout code very closely and found <asp:Content> was written in the lower case asp:content. This was the root cause for this problem. It should be <asp:Content> C must be in capital letter. Otherwise sharepoint will inject the junk values after the closing tag of </asp:Content>


No comments:

Post a Comment