我该如何重定向浏览器在ASP.NET本地文件? [英] How do I redirect a browser to a local file in ASP.NET?

查看:149
本文介绍了我该如何重定向浏览器在ASP.NET本地文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想火狐打开的 C:\\ somefile.txt 的本地驱动器上。我试着用的Response.Redirect文件:///preFIX,但它只是插入对象转移到这里。到页面中。我也想htmlen code中的路径,因为它可能包含特殊字符...


  

编辑:需要明确的是: C:\\ somefile.txt 的是关于客户端框中输入文件运行浏览器



解决方案

说实话,我不太知道为什么的Response.Redirect(文件:/// AAA)是不是为你工作。没有阅读的RFC,或测试它自己,我不知道。

- 编辑:

测试自己;肯定是行不通的。

有人失败表明你怎么了,你可以只写一写链接到它,或者使用一些(当然跛脚)的JavaScript(写入到客户端,而不是重定向),像这样:

 < SCRIPT LANGUAGE =JavaScript的> document.location =文件:/// AAAA;< / SCRIPT>

I want firefox to open C:\somefile.txt on the local drive. I've tried response.redirect with the "file:///" prefix, but it just inserts "Object moved to here." into the page. I also want to htmlencode the path because it could contain special chars...

Edit: To be clear: C:\somefile.txt is a file on the client box running the browser

解决方案

To be honest I don't quite know why Response.Redirect("file:///aaa") isn't working for you. Without reading the RFC, or testing it myself, I don't know.

-- Edit:

Tested myself; definitely doesn't work.

Failing someone showing you how, you can just write write a link to it, or use some (admittedly lame) javascript (to be written to the client, instead of Redirecting) like so:

<script language="javascript">document.location = "file:///aaaa";</script>

这篇关于我该如何重定向浏览器在ASP.NET本地文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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