locked
UocFileDownload Control RCDC and Binary files RRS feed

  • Question

  • Hi, I have some trouble with the UocFileDownload RCDC regarding binary files. I have a MIM setup where we want to upload PDF files to the MIM service and be able to download/view them using this RCDC control later. But when we click on the hyperlink created by the UocFileDownload control, it always appends ".txt" at the end of the filename. We can rename the file later to ".pdf" and it will open correctly - but this should be correct right away?

    In our RCDC XML we clearly specify a "PromptedFileName" - but it appends this ".txt" anyway...

    XML:

       	<my:Control my:Name="tidmFileDataDownload" my:TypeName="UocFileDownload" my:Caption="{Binding Source=schema, Path=tidmFileData.DisplayName, Mode=OneWay}" my:Description="{Binding Source=schema, Path=tidmFileData.Description, Mode=OneWay}">
       		<my:Properties>
       			<my:Property my:Name="Text" my:Value="filename.pdf"/>
       			<my:Property my:Name="PromptedFileName" my:Value="filename.pdf"/>
       			<my:Property my:Name="ContentType" my:Value="binary"/>
       			<my:Property my:Name="Value" my:Value="{Binding Source=object, Path=tidmFileData}"/>
       		</my:Properties>
       	</my:Control>

    If i upload for example a image file (bmp, tif, png), the file downloads with correct filename (after i set "PromtedFileName" correct)

    /Fredrik

    Friday, May 25, 2018 8:44 AM

All replies

  • Hi Fredrik,

    Could you please check what Content-Type header Sharepoint is presenting for the file (e.g. using the F12 Developer Console)?


    Perhaps it's just a matter of registering the correct mime type with Sharepoint / IIS ?

    Br,

    Leo


    Did my post help? Please use "Vote As Helpful", "Mark as answer" or "Propose as answer". Thank you!

    Friday, May 25, 2018 11:28 AM
  • Took a fiddler capture to see the headers on the actual "download file" request:

    1. Request .PDF file from MIM portal (/identitymanagement/ashx/Download.ashx?contentType=binary&promptedFileName=Confidentiality%20Agreement.pdf&cacheKey=2f03bab8-8613-4074-95e8-012c7cfb90e5):

    HTTP/1.1 200 OK
    Cache-Control: private
    Transfer-Encoding: chunked
    Content-Type: text/html
    Content-Encoding: gzip
    Content-Disposition; attachment; fileName=Confidentiality Agreement.pdf.txt


    2. Request .PNG file from MIM Portal (/identitymanagement/ashx/Download.ashx?contentType=binary&promptedFileName=Confidentiality%20Agreement.png&cacheKey=5d0d4d61-dd43-4685-8924-100f9b59d92c)

    HTTP/1.1 200 OK
    Cache-Control: private
    Transfer-Encoding: chunked
    Content-Type: text/html
    Content-Encoding: gzip
    !Content-Disposition; attachment; fileName=Confidentiality Agreement.png
    

    As you can see, IIS/Sharepoint responds with "text/html" for both request. Request 1 downloads with this .txt ending and Request 2 is all good - but with some strange headers..

    I will do some MIME type tests on monday to see if that will change anything.

    /Fredrik

    Friday, May 25, 2018 12:57 PM