Trouble Registering ASP.Net User Controls in web.config
Greetings.
Does Sitefinity support registering user controls in the web.config? I am attempting to register my user controls under the <System.Web><Pages><Controls> node, as below, but get a runtime error.
<
pages
>
<
controls
>
<
add
tagPrefix
=
"myPrefix"
tagName
=
"myControl"
src
=
"~/UserControls/MyControl.ascx"
/>
</
controls
>
</
pages
>
An unhandled exception was generated during the execution of the current
web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.
|
[NullReferenceException: Object reference not set to an instance of an object.] Telerik.Sitefinity.Configuration.WebConfig.LoadTagNamespeces(XmlDocument doc) +237 Telerik.Sitefinity.Configuration.WebConfig..cctor() +96 [TypeInitializationException: The type initializer for 'Telerik.Sitefinity.Configuration.WebConfig' threw an exception.] Telerik.Sitefinity.Configuration.WebConfig.get_ResourceProviderFactoryType() +0 Telerik.Sitefinity.Web.SiteMapBase.Initialize(String name, NameValueCollection attributes) +278 Telerik.Sitefinity.Web.SiteMapBase.GetSiteMapProvider(String rootName) +359 Telerik.Sitefinity.Web.SitefinityRoute.GetRouteData(HttpContextBase httpContext) +68 System.Web.Routing.RouteCollection.GetRouteData(HttpContextBase httpContext) +285 System.Web.Routing.UrlRoutingModule.PostResolveRequestCache(HttpContextBase context) +60 System.Web.Routing.UrlRoutingModule.OnApplicationPostResolveRequestCache(Object sender, EventArgs e) +86 System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +148 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75 |
Found the problem. I had a comment inside <system.web><pages><controls>. Once the comment was removed, the exception was no longer thrown.
<
pages
>
<
controls
>
<!-- Comment -->
<
add
tagPrefix
=
"myPrefix"
tagName
=
"myControl"
src
=
"~/UserControls/MyControl.ascx"
/>
</
controls
>
</
pages
>
ٍSame here and fixed by removing the commented line. Strange!!!
Anyway, thanks for your comment, really helped me :)