在asp.net中打开文件-Response.redirect [英] Open files in asp.net - Response.redirect

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

问题描述



我正在使用asp.net2005.我想从本地计算机打开一些文件(jpg,txt,pdf).我为此编写了以下代码.


response.redirect("d:\\ rp.png");


在IE中:错误是:权限被拒绝

在FireFox中,错误是:
Firefox不知道如何打开该地址,因为协议(d)与任何程序都没有关联.


任何帮助请.


问候,


Hardik Shah.

Hi,

I am working on asp.net 2005. I want to open some files (jpg,txt, pdf) from local machine . I write following code for that.


response.redirect("d:\\rp.png");


In IE : Error is : Permission Denied

In FireFox Error is :
Firefox doesn''t know how to open this address, because the protocol (d) isn''t associated with any program.


Any help pl.


Regards,


Hardik Shah.

推荐答案

首先,它是什么:权限被拒绝.您的D盘没有IUSR_YourMashineName帐户的权限.

第二:这是处理您想要做的事情的错误方法.
将文件放在应用程序中(例如在根文件夹上)并运行
First of all it is what it is: Permission denied. Your D drive does not have the permission for IUSR_YourMashineName account.

Second: this is the wrong way to handle what you want to do.
Place the file inside your application (say on the root folder) and run
Response.Redirect("/rp.png");


然后它将起作用.


Then it will work.


Response.Redirect(System.IO.Path.Combine(Request.PhysicalApplicationPath, "rp.png"));


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

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