Omicron Llama

Coding all day, every day.

Invalid URL when Programmatically Setting Custom Master Page

Just thought I’d pop this here…

When you’re setting a custom masterpage for a site in C#, you might just end up with Invalid URL or File Not Found errors when you try to set the property or navigate to the site.

You’ve probably tried all sorts of combinations for the path of the masterpage, but the one that got it working for me was to use attach the Server Relative Url of the web object before the literal path to the masterpage, as shown:

Leave a Reply

Your email address will not be published. Required fields are marked *