SharePoint feature corrupts page layout

Tuesday, Mar 24, 2009 1 minute read Tags: SharePoint
Hey, thanks for the interest in this post, but just letting you know that it is over 3 years old, so the content in here may not be accurate.

Something that I've come across a few times when working on SharePoint/ MOSS 2007 features. When importing a Page Layout the ASPX some times becomes corrupt. You end up with additional HTML inserts once it's been imported into SharePoint.

The corruption is in the form of HTML tags, outside the last </asp:Content> tag.

Well it turns out that the problem is caused when you import an ASPX that has a </asp:content> tag it'll happen.
Did you notice the problem?

That's right, if you have a lowercase c then it'll import corrupt. Let me show the problem again, highlighted this time:

All you need to do is ensure that that has a capital letter, so the tag is </asp:Content> and it's all good again.

The most common cause of this happening is doing a format-document within Visual Studio on the ASPX when it is in the features class-library project. Visual Studio doesn't handle the ASPX file correctly, and formats it as a raw XHTML file, which dictates that the XHTML tags need to be in all lowercase.

The things you discover...