There're some mistakes in your code, not sure they are calling exception, but worth fixing anyway. First of all you do not really read the page as your ReadOptions
are null
when you read it. Second, you should get your page from Localize
method and then update localized version of the page. Like this:
try
{
// You need read options here
pData = (PageData) client.Read(page.Attribute("ID").Value, new ReadOptions());
//Localize Page
if (!(bool)pData.BluePrintInfo.IsLocalized)
{
// Get localized page here
pData = (PageData) client.Localize(pData.Id, new ReadOptions());
if (dTemplateIDs.ContainsKey(pData.PageTemplate.IdRef.ToString()))
{
pData.IsPageTemplateInherited = false;
pData.PageTemplate.IdRef = dTemplateIDs[pData.PageTemplate.IdRef];
// You do not need read options here
client.Update(pData, null);
}
}
}
catch (Exception ex)
{
Console.WriteLine("Error Inner " + ex.Message);
}
And finally, if it all will not help,can you post stack trace as well?