开发者

How can I provide links to intranet files through ASP.net?

开发者 https://www.devze.com 2022-12-29 05:10 出处:网络
Conditions: The files must be opened outside of the window that the link to them is in. I have tried href, but 开发者_开发百科when I give it an intranet link it only opens correctly if I leave out ta

Conditions: The files must be opened outside of the window that the link to them is in.

I have tried href, but 开发者_开发百科when I give it an intranet link it only opens correctly if I leave out target="_blank"; if I put that in, the new window that opens doesn't receive the full link if there is a pound sign in the filepath... a direct link to the intranet address \a\b\c#c.txt would be fine with me; there is no concern about security, but I can't seem to get that to happen in a new window. It seems like this is happening when I don't create a new window, but I can't utilize the same window to open the links.

Any ideas?


It's a bit of a hack but try changing the links to href="#" onclick="window.open('http://' + escape(restofurl))"


Even if you can get the link to work, the user accessing it may or may not have rights to see that machine.

What I do in cases where I have to link to other files on other server, is link to a generic handler(.ashx file) that does impersonation of user that does have rights, or impersonates the logged-in user. The handler then reads the contents of the file and streams it to the user.


Have you tried streaming the file contents to the browser?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号