1

I'm making a custom master page with a custom CSS file, being deployed in a feature form VS2010. I'm using the CssRegistation control to add the new CSS, but whenever I try to load a page that uses it, I get an "Illegal characters in path" exception. Which is odd, because there aren't any illegal characters that I can see in the path.

The code I'm using to add the CSS to the page looks like this (from MSDN):

<SharePoint:CssRegistration name="<% $SPUrl:~sitecollection/Style Library/myfolder/mystyle.css %>"  After="corev4.css" runat="server"/>

I've check the relevant galleries and the master page is deploying correctly to _layouts/masterpage/mymaster.master, and the CSS is deploying correctly to Style Library/myfolder/mystyle.css.

What have I missed?

3 Answers 3

1

Have you tried changing "Style Library" to "Style%20Library"?

2
  • Doesn't work - '%' is an illegal character when explicitly declared in the path. Commented Jun 27, 2012 at 7:35
  • Shot in the dark. Commented Jun 27, 2012 at 17:47
1

I'm an idiot. The error was coming from an old CssRegistration control that I hadn't commented out properly...

1
  • Happens to the best of us. Commented Jun 27, 2012 at 17:47
0

According to this blog post, you will have that issue if you are using SharePoint Foundation: http://blogs.msdn.com/b/sharepointdesigner/archive/2010/04/09/working-with-the-sharepoint-theming-engine.aspx. In SPF you need to hard code the URL.

2
  • Yes that's right. The <% $SPUrl ~sitecollection token is part of the Publishing Infrastructure which is not available in SharePoint Foundation. But did @Moray mention that he/she is using foundation? Commented Jun 26, 2012 at 15:49
  • I'm using SharePoint Standard. Commented Jun 27, 2012 at 7:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.