如何从 asp.net C# web 应用程序中找到下载文件的路径以检查下载文件的完整性?

How to find the path of the downloaded file from asp.net C# web application for checking the integrity of the downloaded file?

我正在使用 ASP.NET 开发 Web 应用程序。用户可以从站点下载 excel 模板。现在,我想检查文件的完整性,以检查文件是否与服务器上的文件相同并且没有损坏。我可以通过使用 server.mappath() 方法识别路径来获取服务器上文件的 md5 哈希码,但是如何获取下载文件的位置以生成和检查哈希码。

how can i get the location of the downloaded file to generate and check the hashcodes.

你不能。 (这是一件好事)。另外,你不应该。

您无法通过浏览器访问客户端的系统资源。您可以使用 ActiveX (或 others browser/OS specific 来做类似的事情 但是 更好的选择是只提供每次下载的哈希值,让用户验证文件的完整性。