Try our conversational search powered by Generative AI!

Custom ContentProvider routing issue


We've made a custom ContentProvider for listing a document structure from Sharepoint. 

Since the structure is outside the asset root, according to some examples you can add routes for it like we're doing in an IInitializableModule:

                name: "Sharepoint",
                url: ProviderName + "/{node}/{partial}/{action}",
                defaults: new { action = "index" },
                contentRootResolver: s => fileRoot.ContentLink);

                name: "SharepointEdit",
                url: CmsHomePath + ProviderName + "/{language}/{medianodeedit}/{partial}/{action}",
                defaults: new { action = "index" },
                contentRootResolver: s => fileRoot.ContentLink);

This works fine in Edit-mode, we can download the documents from there, but in View-mode we get 404. 

The URL we're trying to access (as it appears by for instance dragging a file into a XHTML-property looks like this: /sharepoint/rovvilt/sno-rovviltkontakter/rovviltkontakter.xlsx which is correct according to the document structure.

Any hints would be appreaciated!

Jan 31, 2019 14:26

By hooking into the RoutedContent event, I can see that the correct route is being hit and the correct content is fetched - still no clue to what causes the 404. 

However, I turned on a bit more logging and I found this in the logs:

2019-02-01 12:13:52,534 [177] ERROR EPiServer.Global: Unhandled exception in ASP.NET
System.Web.HttpException (0x80004005): Not Found.
at EPiServer.Web.BlobHttpHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Maybe this means there is something going on with reading the blob from the content (though I can do that just fine in the RoutedContent-eventhandler). 

My next step is implementing a custom http handler to see if I can replicate the log error, but if anyone knows what this could be, all help is appreciated. 

Feb 01, 2019 13:35

I made a custom httphandler for the media type and replaced Episerver's BlobHttpHandler with my own implemenation (using identical reflected code) and as it turns out the problem was that the content was failing Episervers publish-check - IsPendingPublish was set to true (even though Published was also true and StartPublish was two days ago, this caused it to fail the check). 

Setting IsPendingPublish to false upon creating the Content in the ContentProvider resolved the issue. 

Feb 01, 2019 15:26
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.