文件未打开. [英] Files are not opening.

查看:69
本文介绍了文件未打开.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

在Web表单中,按钮的功能是从特定目录中打开文件.我在此功能中所做的是:我正在寻找一个特定的命名文件,并使用Process.Start()方法打开它.

功能如下;


Hello all,

In a web form, the functionaltiy of a button is to open a file from a specific directory. What I am doing in this function is; I am looking for a specific named file and open it with Process.Start() method.

The function is as follows;


Process openCustomPDF = new Process();
        string fileToRenamePath = RMAConfig.PDFPath + "Return Documentation [ " + this.rmaObjSum.RMANum + " ]" + RMAConfig.Extension;               
        openCustomPDF.StartInfo.FileName = fileToRenamePath;
        openCustomPDF.Start();



问题是当我在计算机上工作时,单击此按钮将打开我想要的文件,并且我可以很好地查看它.但是,当它在生产服务器中时,单击该按钮将不会打开该文件.我可以看到页面重新加载,但是当我单击它时什么也没有发生.我检查了我要打开的文件是否存在于该指定路径中.它在那里.是什么可能阻止它开放任何想法?我正在使用Win7.可能是Win7安全问题,还是我需要关闭某些功能?



The problem is when i am working on my computer, clicking this button will open the file that I want and I can view it perfectly fine. But when it is in production server, clicking the button will not open the file. I can see the page reloads but nothing happens when i click on it. I have checked if the file that i want to open is existing in that specified path. And it is there. What might be blocking it from opening any ideas? I am using Win7. Can it be Win7 security issues or do i need to turn off something?

推荐答案

如果我了解您的要求...

如果路径位于代表您的网站的虚拟文件夹之外,则您将无法访问该文件.换句话说,该文件必须位于网站文件夹层次结构中.如果已经存在,请使用虚拟路径(〜somefolder/filename.pdf"),然后执行以下操作:

If I understand what you''re asking...

If the path is outside the virtual folder representing your web site, you won''t be able to get to the file. In other words, the file has to be INSIDE the web site folder hierarchy. If it already is, use a virtual path ("~somefolder/filename.pdf"), and then do this:

openCustomPDF.StartInfo.Filename = MapPath(myVirtualPath);


这篇关于文件未打开.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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