Make download files from a PDA

Topics: Business Logic Layer
Feb 12, 2008 at 10:43 AM
I noticed that the download of attached files to a Post or Comment from a PDA client browser works only with wav and txt extensions (while from a PC browser things works always). For other file extension it tries to download the "file.axd".
To make things works properly also for .doc .xls .ppt files I had to set more content-type in the FileHandeler.cs (BlogEngine.Core.Web.HttpHandlers), as follows.

However I didn't succeed to download .pdf files even thought I the content-type is set to application-pdf (I tried also with application/x-pdf with no success!).
Does someone know how to make possible to download .pdf file from a PDA (Windows Mobile 6)?

Always from a PDA client (with a PC browser it works), how to make the proposed filename in the save procedure be the real filename (it propose always the name "file" [ex. It ask in a popup window: Download the 2.4 Kb file "file.doc" to \MyDocuments ? ... even thought the real filename was different. (I tried to set context.Response.AddHeader("Content-Disposition", "attachment; filename=" + fileName); ... but with no success!)

private static void SetContentType(HttpContext context, string fileName)
{
if (fileName.EndsWith(".pdf"))
{
context.Response.AddHeader("Content-Type", "application/x-pdf");
}
else if (fileName.EndsWith(".xls"))
{
context.Response.AddHeader("Content-Type", "application/vnd.ms-excel");
}
else if (fileName.EndsWith(".doc"))
{
context.Response.AddHeader("Content-Type", "application/msword");
}
else if (fileName.EndsWith(".ppt"))
{
context.Response.AddHeader("Content-Type", "application/ms-powerpoint");
}
else
{
context.Response.AddHeader("Content-Type", "application/octet-stream");
}
}