.NET窗体身份验证:如何限制验证用户的访问,如PDF文件等资源只 [英] .NET Forms Authentication: How to limit access to resources like pdf files to authenticated users only

查看:173
本文介绍了.NET窗体身份验证:如何限制验证用户的访问,如PDF文件等资源只的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用.net2.0和IIS6。

I am using .net2.0 and IIS6.

在使用.NET窗体身份验证:如何限制访问,如PDF文件,只有经过身份验证的用户资源;所以为了访问一个文件说mysite.com/mydoc.pdf,他们就必须首先验证(通过登录页面)

When using .net Forms Authentication: How to limit access to resources like pdf files to authenticated users only; so in order to access a file say mysite.com/mydoc.pdf they would have to be authenticated first (go through the login page)

看来,在默认情况下只在.aspx页面已经被保护。例如。以包括html的,我只好按照步骤描述这里

It seems that by default only the .aspx pages are protected. E.g. to include the .html, I had to follow the steps described here.

修改

谢谢你们了非常快的答复中,<一个href="http://stackoverflow.com/questions/272447/net-forms-authentication-how-to-limit-access-to-resources-like-pdf-files-to-aut#272455">answer通过Keltex 工作完美的我,因为我需要一个演示系统速战速决。

Thanks guys for very quick replies, the answer by Keltex worked perfectly for me as I needed a quick fix for a demo system.

其他答案是非常有趣的,以及,当与生产系统处理,他们将是有用的。

Other answers are very interesting as well and they will be useful when dealing with the production system.

您更欢迎届时张贴其他的答案

You are more then welcome to post other answers

推荐答案

您必须配置IIS来处理通配符扩展。因此,.PDF和放大器; HTML扩展将被认证。以下是如何为IIS6:

You have to configure IIS to process wildcard extensions. Thus .pdf & .html extensions will be authenticated. Here's how for IIS6:

<一个href="http://professionalaspnet.com/archive/2007/07/27/Configure-IIS-for-Wildcard-Extensions-in-ASP.NET.aspx" rel="nofollow">http://professionalaspnet.com/archive/2007/07/27/Configure-IIS-for-Wildcard-Extensions-in-ASP.NET.aspx

这篇关于.NET窗体身份验证:如何限制验证用户的访问,如PDF文件等资源只的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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