如何在asp.net中进行文件夹明智的身份验证 [英] How to give folder wise authentication in asp.net

查看:87
本文介绍了如何在asp.net中进行文件夹明智的身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我想通过只使用编码在asp.net ..中提供Folderwise auhtentication.请帮助我深入解释..

Hi
I want give folderwise auhtentication in asp.net.. by using coding only. pls help me to explain deeply..

推荐答案

假设您正在使用 ^ ]和角色 [
Assuming you are using Membership[^] and Role[^] Providers, all you need to do is set the appropriate permissions in the folders web.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <system.web>
        <authorization>
            <allow roles="Admin" />
            <deny users="*" />
        </authorization>
    </system.web>
</configuration>



如果您决心自己做,请查看成员资格提供程序"和角色提供程序",它们在效果上与默认提供程序和角色提供程序相似,但是您可以自己编写代码.当然,它们无疑是最简单的方法,另一种方法是在母版页Load事件中重塑轮子-要做更多的工作.



If you are determined to do it yourself, then have a look at Membership Providers and Role Providers - these are similar in effect to the default ones, but you code them yourself. They are certainly the easiest way to do it, the alternative being to reinvent the wheel in your master page Load event - a lot more work.



这篇关于如何在asp.net中进行文件夹明智的身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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