Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Lee 5 posts 76 karma points
    Dec 12, 2017 @ 15:53

    Unable to cast object of type 'System.Xml.XmlDocument' to type 'System.Xml.XmlElement'

    Hello All,

    I am trying to use 301 tracker with Umbraco 7.7.6 and after installing it and trying to create a redirect I get the following error:

    Unable to cast object of type 'System.Xml.XmlDocument' to type 'System.Xml.XmlElement'.

    Does anyone have any ideas why this might be happening?

    Thanks for your help :)

  • Daniel Chenery 119 posts 465 karma points
    Dec 12, 2017 @ 16:49
    Daniel Chenery

    Can't say I've seen this issue before, although I can't say I've tested with 7.7.6 yet either ;)

    I don't suppose you could provide a stack trace could you?

  • Lee 5 posts 76 karma points
    Dec 12, 2017 @ 16:56

    thanks for the quick reply, here is a stacktrace,

    Server Error in '/' Application.
    Unable to cast object of type 'System.Xml.XmlDocument' to type 'System.Xml.XmlElement'.
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 
    Exception Details: System.InvalidCastException: Unable to cast object of type 'System.Xml.XmlDocument' to type 'System.Xml.XmlElement'.
    Source Error: 
    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.
    Stack Trace: 
    [InvalidCastException: Unable to cast object of type 'System.Xml.XmlDocument' to type 'System.Xml.XmlElement'.]
       Umbraco.Web.PublishedCache.XmlPublishedCache.PublishedContentCache.DetermineRouteById(UmbracoContext umbracoContext, Boolean preview, Int32 contentId) +224
       Umbraco.Web.PublishedCache.XmlPublishedCache.PublishedContentCache.GetRouteById(UmbracoContext umbracoContext, Boolean preview, Int32 contentId) +86
       Umbraco.Web.Routing.DefaultUrlProvider.GetUrl(UmbracoContext umbracoContext, Int32 id, Uri current, UrlProviderMode mode) +65
       Umbraco.Web.Routing.<>c__DisplayClass16_0.<GetUrl>b__0(IUrlProvider provider) +28
       System.Linq.WhereSelectArrayIterator`2.MoveNext() +58
       System.Linq.Enumerable.FirstOrDefault(IEnumerable`1 source, Func`2 predicate) +94
       Umbraco.Web.Routing.UrlProvider.GetUrl(Int32 id, Uri current, UrlProviderMode mode) +192
       Umbraco.Web.Routing.UrlProvider.GetUrl(Int32 id) +14
       InfoCaster.Umbraco.UrlTracker.Models.UrlTrackerModel.get_CalculatedRedirectUrl() in D:\kipusoep\Documents\GitHub\UrlTracker\Models\UrlTrackerModel.cs:105
    [TargetInvocationException: Property accessor 'CalculatedRedirectUrl' on object 'InfoCaster.Umbraco.UrlTracker.Models.UrlTrackerModel' threw the following exception:'Unable to cast object of type 'System.Xml.XmlDocument' to type 'System.Xml.XmlElement'.']
       System.ComponentModel.ReflectPropertyDescriptor.GetValue(Object component) +378
       System.Web.UI.WebControls.BoundField.TryGetSimplePropertyValue(Object dataItem, Object& data) +89
       System.Web.UI.WebControls.BoundField.GetValue(Control controlContainer) +209
       System.Web.UI.WebControls.BoundField.OnDataBindField(Object sender, EventArgs e) +58
       System.Web.UI.Control.OnDataBinding(EventArgs e) +84
       System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +150
       System.Web.UI.Control.DataBind() +17
       System.Web.UI.Control.DataBindChildren() +185
       System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +160
       System.Web.UI.Control.DataBind() +17
       System.Web.UI.WebControls.GridView.CreateRow(Int32 rowIndex, Int32 dataSourceIndex, DataControlRowType rowType, DataControlRowState rowState, Boolean dataBind, Object dataItem, DataControlField[] fields, TableRowCollection rows, PagedDataSource pagedDataSource) +167
       System.Web.UI.WebControls.GridView.CreateChildControls(IEnumerable dataSource, Boolean dataBinding) +3741
       System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +67
       System.Web.UI.WebControls.GridView.PerformDataBinding(IEnumerable data) +14
       System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +128
       System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +34
       System.Web.UI.WebControls.DataBoundControl.PerformSelect() +143
       System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +74
       System.Web.UI.WebControls.GridView.DataBind() +9
       System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +114
       System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +75
       System.Web.UI.Control.EnsureChildControls() +92
       System.Web.UI.WebControls.GridView.get_Rows() +34
       InfoCaster.Umbraco.UrlTracker.UI.UrlTrackerManager.OnPreRender(EventArgs e) in D:\kipusoep\Documents\GitHub\UrlTracker\UI\UrlTrackerManager.aspx.cs:148
       System.Web.UI.Control.PreRenderRecursiveInternal() +88
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +985
  • Daniel Chenery 119 posts 465 karma points
    Dec 13, 2017 @ 15:20
    Daniel Chenery

    Thanks! I'll try and look into this when I can.

    What version of the plugin are you using by the way? 3.14.1 is the latest.

    Umbraco 7.7.7 seems to be out too, have you any more luck with that?

  • Lee 5 posts 76 karma points
    Dec 13, 2017 @ 15:33

    Thanks :)

    I checked the version and it seemed that i was installing 3.11.1 as I did it from inside Umbraco's packet manager screen, I will try and packet manager install and see if that fixes the issue.

    If that doesn't solve it I will try a 7.7.7 update and try again, I'll let you know how I get on :)

  • Daniel Chenery 119 posts 465 karma points
    Dec 13, 2017 @ 15:34
    Daniel Chenery

    Ah, yes the Our Umbraco listing is no longer managed

  • Lee 5 posts 76 karma points
    Dec 13, 2017 @ 15:50

    That makes sense, sadly it doesn't seen to have solved the issue, I have uninstalled the package, installed the new version via PM and cleaned out the icUrlTracker db table but once I create a redirect I get the stack trace above.

  • Daniel Chenery 119 posts 465 karma points
    Dec 13, 2017 @ 19:19
    Daniel Chenery

    I've spun up a 7.7.6 site, and I can't replicate your issue. I've even tried redirecting to unpublished/deleted pages.

    • Does the same issue occur on a new website?
    • Are you doing anything special/out of the ordinary with your redirect?
Please Sign in or register to post replies

Write your reply to: