是否PostedFile.FileName在.NET 4.0中的工作方式不同? [英] Does PostedFile.FileName work differently in .Net 4.0?

查看:175
本文介绍了是否PostedFile.FileName在.NET 4.0中的工作方式不同?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的一个ASP.Net网站,允许用户连接使用UNC路径的文件。本网站所使用的我们对内部流程的客户,所以对他们的域中的所有用户应该能够访问的UNC路径。

I'm working on an ASP.Net site which allows users to link documents using a UNC path. This site is used by a customer of ours for internal processes, so all users on their domain should have access to the UNC path.

当一个用户想增加一个链接的文档,他们选择使用一个FileUpload控制该文件。 previously .NET 2.0中,该控件的PostedFile.FileName属性返回的文件名和完整的UNC路径。现在我们使用的是.NET 4.0和只返回文件名。

When a user wants to add a linked document, they select the file using a FileUpload control. Previously in .Net 2.0, the control's PostedFile.FileName property returned the filename and the full UNC path. Now we are using .Net 4.0 and it only returns the filename.

这是我的主要问题:请问PostedFile.FileName工作方式不同在.NET 4.0中相比,2.0?

Here's my main question: Does PostedFile.FileName work differently in .Net 4.0 compared to 2.0?

如果没有,还有什么可以引起这个问题?

If not, what else could cause this problem?

推荐答案

我认为这不是.NET,但Internet Explorer的哪些安全growed了。

I assume that it's not .NET but the internet explorer which growed up in security.

从<一个href="http://blogs.msdn.com/b/ie/archive/2008/07/02/ie8-security-part-v-com$p$phensive-protection.aspx">here:

此外,包含本地目录路径上传文件时   URLAction已被设置为禁用Internet区域。这种变化   潜在的敏感的本地文件系统的prevents泄漏   信息到互联网。例如,而不是在提交   完整的路径C:\用户\ ericlaw \文件\机密\ image.png,互联网   Explorer 8中的现在只提交文件名image.png

Additionally, the "Include local directory path when uploading files" URLAction has been set to "Disable" for the Internet Zone. This change prevents leakage of potentially sensitive local file-system information to the Internet. For instance, rather than submitting the full path C:\users\ericlaw\documents\secret\image.png, Internet Explorer 8 will now submit only the filename image.png.

所以,你可以

  1. 更​​改服务器端code中的逻辑 - 它不应该依赖于客户端的文件路径,并只需要使用FileUpload控件的FileName属性

  1. Change the logic in the server-side code - It should not be dependent on the client-side file path location and should simply use the FileName property of the FileUpload control.

启用IE 8 / IE 9的选项,包括在客户端的Internet区域的本地目录路径(骚扰用户)。

Enable the IE 8 / IE 9 option to include the local directory path for the Internet Zone on the client-side(annoy the user).

这篇关于是否PostedFile.FileName在.NET 4.0中的工作方式不同?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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