middleware to output custom headers for media requ...
# help-with-umbraco
o
Hello community friends, I'm creating a media middleware to output custom headers for media request It injects custom header to media request so search crawler can get all the info correctly I attached sample response from the middleware I created in postman, with the custom headers. And I have registered the middleware before app.useumbraco() (Put it after unable to retrieve any value out of the media item) Problem: the media item has a custom field "searchTopic" that is a tree node picker, select a list of topics from content. I'm unable to retrieve the value from it by calling var topics= mediaItem.GetValue<IEnumerable>("searchTopic"); Because the all content is not ready yet, it just returns NULL. What seems to me is that when the media pipeline is ready with all fields value available, the content is not ready yet, unable to access any content node item. Any idea how I can resolve this? https://cdn.discordapp.com/attachments/1238521614539296940/1238521615147339847/image.png?ex=663f96a3&is=663e4523&hm=3806c4631b3855722c85ad6acf8600a183b484cea64f6b54430a9d21de39f1da& https://cdn.discordapp.com/attachments/1238521614539296940/1238521615487205406/image.png?ex=663f96a3&is=663e4523&hm=db11501cadc59636ec841f2b4f72d11b1db578ef3e87fd7a3df987b38bfb9dcf& https://cdn.discordapp.com/attachments/1238521614539296940/1238521615772291132/image.png?ex=663f96a3&is=663e4523&hm=72206332a95d152e53ab1aee3d8e085cdee563d9018f804b05749435cc40f842&
I've already found the solution, so the mediaItem.GetValue<IEnumerable>("searchTopic"); does not work for mediaItem, it only works for ipublishedcontent object. I just get the raw string value out of the field, and read the GUID split by comma, then get content item from it! Resolved!
4 Views