文件从远程服务器完整路径路径、完整、服务器、文件

由网友(若妳是海莪願削足爲魚)分享简介:我正与文件,我真的不知道如何使它发挥作用。I am working with files and I don't really understand how to make it work.我有一个Web应用程序(C#)位于在服务器上,用户使用该应用程序上传的文件的一些信息。说我有用户从本地计算机上传的文件(使用...

我正与文件,我真的不知道如何使它发挥作用。

I am working with files and I don't really understand how to make it work.

我有一个Web应用程序(C#)位于在服务器上,用户使用该应用程序上传的文件的一些信息。说我有用户从本地计算机上传的文件(使用 HttpPostedFileBase 类),但code尝试匹配相同的路径在服务器上,问题当然,该文件不存在于服务器上,这就是为什么它抛出一个错误,指出

I have a web application (c#) that is located on the server and users use this application to upload some information from the files. The problem that I am having that users upload the file (using HttpPostedFileBase class) from their local machines but code is trying to match the same path on the server and of course the file doesn't exist on the server, that's why it throws an error saying that

找不到路径的一部分......

Cannot find a part of the path ...

如果用户试图上载从文件C:用户用户1 文档 FILE.TXT 从本地机器我怎么能写code到包括整个路径,包括计算机名称和本地驱动器类似 计算机名文件c $ 用户用户1 Documnets FILE.TXT

If the user is trying to upload the file from C:UsersUser1DocumentsFile.txt from their local machine how can I write the code to include the whole path to the file including the computer name and the local drive something like ComputerNamec$UsersUser1DocumnetsFile.txt.

推荐答案

您不能。客户端和服务器都从彼此断开。这是怎样的网络工作。你不能得到完整的客户端的路径和访问以任何方式从服务器。

You can't. Client and servers are disconnected from each other. That is how the web works. You can't get the full client path and access that in any way from the server.

有很好的理由,最重要的是安全性/信任。

There are very good reasons for this, the most important one is security / trust.

阅读全文

相关推荐

最新文章