本文介绍了下载问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我正在为一家公司开发一个网站,这个网站将有文件可用 供客户下载,但只有客户才能下载能够下载这些文件的和每个客户的可用文件 取决于客户的类型。 so如何通过输入完整的URL来阻止用户下载文件 (例如, http://www.company.com/file.exe ) 如果用户输入文件的url,我想要用户重定向到 登录页面。 **一些文件大于50MB 谢谢Hi,I am developing a site for a company and this site will have files availablefor the customers to download, but only the customers loged in will be ableto download these files and the files availables for each customer willdepend on the type of the customer.so how can I prevent a user from downloading a file by typing the full url(example, http://www.company.com/file.exe)if the user type the url of the file, I want the user to be redirected tothe login page.**some files are larger than 50MBThanks推荐答案 最简单的方法是将所有文件的扩展名映射到IIS中的aspnet dll 。因此,请进入IIS中的Web应用程序,并将.aspx 的dll设置复制到其他每个(.exe,pdf等)。这将导致通过aspnet进程传递请求(这将只提供 文件),使您能够通过表单身份验证保护它们。 注意你会想稍微测试一下,以确保没有问题。 性能影响也应该是最小的。 - Craig Deelsnyder Microsoft MVP - ASP / ASP.NETThe easiest way is to map all of the files'' extensions to the aspnet dllin IIS. So go into your web app in IIS and copy the dll setting for .aspxto each of the other ones (.exe, pdf, etc.). This will cause requests tobe passed thru the aspnet process (which will then just serve up thefile), enabling you to protect them via Forms Authentication.Note you''ll want to test this a little, to make sure of no problems.Performance impact should be minimal as well.--Craig DeelsnyderMicrosoft MVP - ASP/ASP.NET 最简单方法是将所有文件的扩展名映射到IIS中的aspnet dll 。因此,请进入IIS中的Web应用程序,并将.aspx 的dll设置复制到其他每个(.exe,pdf等)。这将导致请求通过aspnet进程传递(然后只会提供文件),使您能够通过表单身份验证保护它们。 请注意你我想稍微测试一下,以确保没有问题。性能影响也应该是最小的。 - Craig Deelsnyder Microsoft MVP - ASP / ASP.NET The easiest way is to map all of the files'' extensions to the aspnet dll in IIS. So go into your web app in IIS and copy the dll setting for .aspx to each of the other ones (.exe, pdf, etc.). This will cause requests to be passed thru the aspnet process (which will then just serve up the file), enabling you to protect them via Forms Authentication. Note you''ll want to test this a little, to make sure of no problems. Performance impact should be minimal as well. -- Craig Deelsnyder Microsoft MVP - ASP/ASP.NET 最简单的方法是映射IIS中所有文件对aspnet dll的扩展。因此,进入IIS中的Web应用程序并将 ..aspx的dll设置复制到其他每个(.exe,pdf等)。这将导致请求通过aspnet进程传递(这将只提供文件),使您能够通过表单身份验证保护它们。 请注意你我想稍微测试一下,以确保没有问题。性能影响也应该是最小的。 - Craig Deelsnyder Microsoft MVP - ASP / ASP.NET The easiest way is to map all of the files'' extensions to the aspnet dll in IIS. So go into your web app in IIS and copy the dll setting for..aspx to each of the other ones (.exe, pdf, etc.). This will cause requeststo be passed thru the aspnet process (which will then just serve up the file), enabling you to protect them via Forms Authentication. Note you''ll want to test this a little, to make sure of no problems. Performance impact should be minimal as well. -- Craig Deelsnyder Microsoft MVP - ASP/ASP.NET 这篇关于下载问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-05 23:30