Cannot convert document type 'x' to document type 'y' or document type not found. Node id: '1125', node name: 'xxx'
When trying to access a protected page on the site before being logged in the exception:
Cannot convert document type 'x' to document type 'y' or document type not found. Node id: '1125', node name: 'xxx' is thrown? Why would it be trying to convert a document type?
Can you paste the line of the code where this is happening? It's happening probably because you are trying to convert an Umbraco content (whose node id is 1125) to an instance of your document type ('y') but that node (1125) is not of 'y' document type but 'x'.
Sorry for the delayed response. There wasn't actually any document conversion going on which is why it was a bit confusing. It turns out the Login Page specified for the protected nodes didn't exist but still not entirely sure why that resulted in this exception.
This exception can also happen if your strongly typed template renders wront document type. If you, for instance, declare your template as:
..MyTemplate: TemplateBase<MyDocumentType1>..
and then declare your MyDocument2 as following:
[...DefaultTemplate="MyTemplate"] (or you add it to allowed templates)
MyDocumentType2...
When MyTemplate is set as a render template for some Umbraco content of MyDocumentType2 you'll also get this exception as template will try to convert MyDocumentType2 to MyDocumentType1.
So without more details it's hard to know what exactly happened.
Cannot convert document type 'x' to document type 'y' or document type not found. Node id: '1125', node name: 'xxx'
When trying to access a protected page on the site before being logged in the exception:
Cannot convert document type 'x' to document type 'y' or document type not found. Node id: '1125', node name: 'xxx' is thrown? Why would it be trying to convert a document type?
Can you paste the line of the code where this is happening? It's happening probably because you are trying to convert an Umbraco content (whose node id is 1125) to an instance of your document type ('y') but that node (1125) is not of 'y' document type but 'x'.
Sorry for the delayed response. There wasn't actually any document conversion going on which is why it was a bit confusing. It turns out the Login Page specified for the protected nodes didn't exist but still not entirely sure why that resulted in this exception.
This exception can also happen if your strongly typed template renders wront document type. If you, for instance, declare your template as:
..MyTemplate: TemplateBase<MyDocumentType1>..
and then declare your MyDocument2 as following:
[...DefaultTemplate="MyTemplate"] (or you add it to allowed templates)
MyDocumentType2...
When MyTemplate is set as a render template for some Umbraco content of MyDocumentType2 you'll also get this exception as template will try to convert MyDocumentType2 to MyDocumentType1.
So without more details it's hard to know what exactly happened.
When I get a chance I'll see if I can reproduce the problem on a clean install and report back.
Thanks, Simon
is working on a reply...