views:

438

answers:

2

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

+3  A: 

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>
Noon Silk
thx, javascript solution worked
akosch
+3  A: 

You can't. Web pages are explicitly not allowed to link or redirect to local content. It's a security measure.

Ted Mielczarek