0
基本上,这是scenario.I创建移动优化的ASP.NET(3.5框架)的应用程序,并且我添加了一个链接来下载xml文件到运行在comapct framework 5.0操作系统上的Motorola GUN。Compact框架中的XML文件下载
文件下载逻辑在桌面/笔记本电脑上正常工作,但在Windows CE设备上,而不是下载文件。它在IE浏览器中打开xml文件。
我需要experties帮助这里:)
基本上,这是scenario.I创建移动优化的ASP.NET(3.5框架)的应用程序,并且我添加了一个链接来下载xml文件到运行在comapct framework 5.0操作系统上的Motorola GUN。Compact框架中的XML文件下载
文件下载逻辑在桌面/笔记本电脑上正常工作,但在Windows CE设备上,而不是下载文件。它在IE浏览器中打开xml文件。
我需要experties帮助这里:)
该设备将要处理,这是专为文件。
您可以尝试将您的文件作为八位字节流发送。
这是类似我做了一段时间回来的东西,但我不能肯定它是否适用于移动设备:
if (!String.IsNullOrEmpty(nameOnly)) {
string filename = Server.MapPath(nameOnly);
if (!String.IsNullOrEmpty(filename)) {
try {
Response.Buffer = false;
Response.Clear(); // clear the buffer
Response.Cache.SetCacheability(HttpCacheability.NoCache);
if (-1 < filename.IndexOf(".avi")) {
Response.ContentType = "video/x-msvideo";
} else if (-1 < filename.IndexOf(".pdf")) {
Response.ContentType = "Application/pdf";
} else if (-1 < filename.IndexOf(".rar")) {
Response.ContentType = "Application/x-rar-compressed";
} else {
Response.ContentType = "Application/octet-stream";
}
FileInfo file = new FileInfo(filename);
Response.AddHeader("Content-Disposition", "attachment; filename=" + nameOnly);
Response.AddHeader("Content-Length", file.Length.ToString());
Response.WriteFile(file.FullName);
} catch (Exception err) {
outputLine = err.Message;
} finally {
Response.Flush();
}
} else {
outputLine = string.Format("Server was unable to locate file \"{0}\".", nameOnly);
}
}
@ jp2code-感谢help.Actually,我试过这种方法,但结果它是相同的。它在桌面上运行良好,但在Windows CE中不起作用。 –