Try our conversational search powered by Generative AI!

Is there any equivalent function of PageTypeResolver.Instance.GetPageTypeType on EPiServer 7


Hi folks,

I'm considering is there any equivalent function of PageTypeResolver.Instance.GetPageTypeType  on EPiServer 7? I use ContentTypeRepository.Load() but it always return ContentType type not typeof(PageData) as result of PageTypeResolver.Instance.GetPageTypeType function.

Any help would be appriciated!

Feb 18, 2013 12:40

A ContentType is a definition that corresponds to a content. ContentType.ModelType gives you your .Net type.

Feb 18, 2013 14:21

I am not sure if this is what you need:

var contentRepo = ServiceLocator.Current.GetInstance<IContentRepository>();
var content = contentRepo.Get<IContent>(new ContentReference(9));
var contentType = content.GetOriginalType();

where 9 is the page ID.   

Edited, Feb 18, 2013 14:25

Thank you all, Johan's approach is what I need.

Feb 18, 2013 17:05
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.