Custom URL rewriter using PageTypeBulder in CMS 6 problem

Vote:
 

My costomized URL rewriter that worked in CMS 5 don't work after upgrade to CMS 6.

It seems that I can't use PageTypeBulder. I get the following exception stack trace when I try to use a typed PageData object

 

2010-05-10 13:41:40,571 ERROR [1] EPiServer.Web.InitializeEngine.Initialize - InitializeAction on method <StaticInitialization>b__5 failed
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at Srrs.FriendlyUrl.SrrsUrlRewriteProvider..ctor()
   --- End of inner exception stack trace ---
   at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck)
   at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache)
   at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic)
   at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
   at EPiServer.Web.UrlRewriteProvider.CreateInstance(ProviderSettings providerSettings)
   at EPiServer.Web.InitializationModule.InitializeUrlRewriteProvider(Settings settings, UrlRewriteElement rewriteSettings)
   at EPiServer.Web.InitializeEngine.Initialize()
2010-05-10 13:41:40,571 ERROR [1] EPiServer.Framework.Initialization.InitializationEngine.InitializeModules - Initialize action failed for Initialize on class EPiServer.Web.InitializationModule, EPiServer, Version=6.0.530.0, Culture=neutral, PublicKeyToken=8fe83dea738b45b7
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at Srrs.FriendlyUrl.SrrsUrlRewriteProvider..ctor()
   --- End of inner exception stack trace ---
   at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck)
   at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache)
   at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic)
   at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
   at EPiServer.Web.UrlRewriteProvider.CreateInstance(ProviderSettings providerSettings)
   at EPiServer.Web.InitializationModule.InitializeUrlRewriteProvider(Settings settings, UrlRewriteElement rewriteSettings)
   at EPiServer.Web.InitializeEngine.Initialize()
   at EPiServer.Web.InitializationModule.StaticInitialization()
   at EPiServer.Web.InitializationModule.Initialize(InitializationEngine context)
   at EPiServer.Framework.Initialization.InitializationEngine.InitializeModules()

2010-05-10 13:41:40,571 ERROR [1] EPiServer.Web.InitializeEngine.Initialize - InitializeAction on method <StaticInitialization>b__5 failedSystem.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object.   at Srrs.FriendlyUrl.SrrsUrlRewriteProvider..ctor()   --- End of inner exception stack trace ---   at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck)   at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache)   at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache)   at System.Activator.CreateInstance(Type type, Boolean nonPublic)   at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)   at EPiServer.Web.UrlRewriteProvider.CreateInstance(ProviderSettings providerSettings)   at EPiServer.Web.InitializationModule.InitializeUrlRewriteProvider(Settings settings, UrlRewriteElement rewriteSettings)   at EPiServer.Web.InitializeEngine.Initialize()2010-05-10 13:41:40,571 ERROR [1] EPiServer.Framework.Initialization.InitializationEngine.InitializeModules - Initialize action failed for Initialize on class EPiServer.Web.InitializationModule, EPiServer, Version=6.0.530.0, Culture=neutral, PublicKeyToken=8fe83dea738b45b7System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object.   at Srrs.FriendlyUrl.SrrsUrlRewriteProvider..ctor()   --- End of inner exception stack trace ---   at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck)   at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache)   at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache)   at System.Activator.CreateInstance(Type type, Boolean nonPublic)   at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)   at EPiServer.Web.UrlRewriteProvider.CreateInstance(ProviderSettings providerSettings)   at EPiServer.Web.InitializationModule.InitializeUrlRewriteProvider(Settings settings, UrlRewriteElement rewriteSettings)   at EPiServer.Web.InitializeEngine.Initialize()   at EPiServer.Web.InitializationModule.StaticInitialization()   at EPiServer.Web.InitializationModule.Initialize(InitializationEngine context)   at EPiServer.Framework.Initialization.InitializationEngine.InitializeModules()

Do I have to write the FriendlyUrlRewriteProvider in another way in CMS 6?

 

#39309
May 10, 2010 13:53
Vote:
 

It might have to do with the new initialization system in CMS 6. If you debug, what is it that is null? Which version of PTB are you using?

#39324
May 10, 2010 19:15
Vote:
 

Thank you for your reply!

I tried both with 1.1 and 1.2 beta.

This happend in the constructor of the provider. I couldn't debug the code so I moved the constructor code into the method that used the initialized variables instead and there it worked. So problem solved. 

 

#39325
May 10, 2010 19:34
Vote:
 

Hi Jonas,

I've got the same issue and I cannot debug either. Could you please explain in more details the solution you found for "moving the constructor code into the method that used the initialized variables instead".....

Thanks,

Bahar

#61407
Edited, Sep 19, 2012 12:10
Vote:
 

Also in my case I'm not migrating from 5 to 6. I'm already on 6 and using page type builder but just trying to add a custom UrlRewiteProvider mainly for rewriting the EPiServer Community based page urls to a SEO friendly urls. 

#61408
Edited, Sep 19, 2012 12:20
* 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.