创建文件夹并在客户端显示一些文档 [英] create folder and show some document in client side

查看:96
本文介绍了创建文件夹并在客户端显示一些文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我有一个Silverlight应用程序,我将一些文件如图像或excel或word文档作为数组添加到数据库中,然后在客户端系统中使用这些代码显示它们,它在我运行时运行视觉工作室但是当我发布我的项目并在iis或网络上运行时,它没有显示附件可以任何身体帮助我吗?

谢谢

Hi I have a Silverlight application ,I attache some file such as image or excel or word document as a array in database , and then show them with these codes in client system, it works when I run it on visual studio but when I publish my project and run it on iis or on a web, It dose not show attached file can any body help me?
thanks

try
          {
              System.IO.Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\CImage");

          }
          catch (Exception ex)
          {
          }

              try
              {
                  System.IO.File.WriteAllBytes(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\CImage\\" + (e.Result.Last().NameFile .ToString().Trim()) + "-" + (e.Result.Last().Id.ToString().Trim()) + "." + (e.Result.Last().Format.ToString().Trim()), e.Result.Last().FileAttach );

              }
              catch (Exception ex)
              {
              }

          try
          {
              dynamic shell = AutomationFactory.CreateObject("Shell.Application");
              shell.ShellExecute(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\CImage\\" + (e.Result.Last().NameFile.ToString().Trim()) + "-" + (e.Result.Last().Id.ToString().Trim()) + "." + (e.Result.Last().Format.ToString().Trim()));

          }
          catch (Exception ex)
          {
              return;
          }

推荐答案

您正在访问MyDocuments文件夹,这是一个SpecialFolder。您无法在正常模式下访问该文件夹,只有具有提升权限的受信任应用程序才能访问此类特殊文件夹。



请检查您的权限,然后重试。如果是其他任何东西,我就超出了我的深度:)
You are accessing the MyDocuments folder, which is a SpecialFolder. You cannot access the folder in normal mode, only trusted applications with elevated privilege can access such type of special folder.

Please check your permissions and try again. If it is anything else, I'm out of my depth :)


这篇关于创建文件夹并在客户端显示一些文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆