Hello,
In the controller of my widget I have the id (guid) of a file in the media library. I want to have the URL of the file so I use MediaFileInfoProvider.GetMediaFileInfo(guid, sitename). The sitename is "DancingGoatMvc" in my example. But every time I use that method, there is a stackoverflowexception and my whole website and iis express shuts down. Since the MediaFileInfoProvider is used in the documentation, I would expect it to work? I use Kentico 12 with Service Pack in MVC.
MediaFileInfoProvider.GetMediaFileInfo(guid, sitename)
Am I doing someting wrong or is there a bug in the GetMediaFileInfo method? Other methods of the MediaFileInfoProvider (for example MediaFileInfoProvider.GetMediaFiles()) work correctly.
GetMediaFileInfo
MediaFileInfoProvider
MediaFileInfoProvider.GetMediaFiles()
I found the solution. The file id I was passing to the GetMediaFileInfo was a dynamic type and not a typed Guid. That was causing the exception. When I give the typed Guid to the method, it works fine!
Please, sign in to be able to submit a new answer.