Try our conversational search powered by Generative AI!

Custom ContentProvider routing issue

Vote:
 

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:

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

RouteTable.Routes.MapContentRoute(
                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!

#200953
Jan 31, 2019 14:26
Vote:
 

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. 

#201010
Feb 01, 2019 13:35
Vote:
 

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. 

#201021
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.