interop.Shell32.dll не находит атрибуты на IIS8/Windows 2012

Этот код работает в разработке с IIS 7.5 для печати расширенных атрибутов файла, но не находит атрибуты при работе на производственном сервере с IIS 8.

Нет ошибок, и атрибуты появляются в проводнике Windows.

Protected files as String = ""

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.LoadDim videoPath As String = Server.MapPath("library/video/")
        Dim videoPath As String = Server.MapPath("library/video/")
        Dim videoFolder As New DirectoryInfo(videoPath)
        Dim attrib As String
        Dim titleDisplay As String

        For Each fil As FileInfo In videoFolder.GetFiles("*.mp4")
            titleDisplay = fil.Name().Replace(fil.Extension(), "")
        attrib = getAttribute(fil, "Title")
        If attrib.Length > 0 Then
            titleDisplay &= "<br /><b>" & attrib & "</b>"
        End If
        attrib = getAttribute(fil, "Tags")
        For Each att In attrib.Split(";")
            titleDisplay &= "<br /><i>" & att & "</i>"
        Next
        files &= "<p>" & titleDisplay & "</p>"
    Next
End Sub


Private Function getAttribute(ByVal file As FileInfo, ByVal attribute As String) As String

    Dim value As String = ""
    Dim shell As New Shell32.Shell()
    Dim fld As Shell32.Folder = shell.NameSpace(Path.GetDirectoryName(file.FullName))

    For Each s In fld.Items()
        If fld.GetDetailsOf(s, 0).ToLower() = Path.GetFileName(file.FullName).ToLowerInvariant Then
            For i As Integer = 0 To 34
                If fld.GetDetailsOf(fld.Items, i) = attribute Then
                    value = fld.GetDetailsOf(s, i)
                    Exit For
                End If
            Next
            Exit For
        End If
    Next

    Return value

End Function

0 ответов

Другие вопросы по тегам