使用c Sharp 3对某些页面进行授权 [英] authorization to some pages using c sharp 3 to some page

查看:68
本文介绍了使用c Sharp 3对某些页面进行授权的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

克里斯蒂安·玛丽亚(Christus and Maria)的艾维里·贝(HI EVREY BODY)第一湾名字
Beissm Patris et Filii et Spiritus Sancti
Beissm父亲,儿子和圣灵
Iam Hapy,因为我从大学毕业.
今年imeet你们中的一些人在代码A项目中工作
可能叫eiad
我爱你,我相信你和你的想法,我很高兴身体健康



拒绝所有人中的所有问题请我与您交谈,我们可以看到可能会发送电子邮件
和我一起聊天

问题??:
湾全部所有人
:我有20个页面,我想使某些页面无法打开而不登录页面,而其他页面则按常规方式

HI EVREY BODY first bay name of Christus and Maria
Beissm Patris et Filii et Spiritus Sancti
Beissm Father, Son and Holy Spirith
iam hapy because i have been gradute fromm university
this year imeet some of you working in code A project
may name is eiad
I LOVE YOU AND I BELIEVE IN YOU AND YOUR IDEAS AND IAM HAPPY FOR EVRY BODY



BAY ALL OF ALL SOME OF YOU ASK ME TO TALK WITH YOU WE CAN YOU CAN SEE MAY EMAIL
AND TALK WITH ME

THE QUESTION??:
BAY ALL OF ALL
: I HAVE APROJECT CONTAIN 20 PAGE I WANT TO MAKE SOME PAGES TO BE NOT OPEN WITHOUT LOG IN PAGE AND OTHER TO BE OPEN BAY USUAL WAY

configuration>
    <system.web>
        <authentication mode="Forms" >
            <forms loginUrl="login.aspx" name=".ASPNETAUTH" protection="None" path="/" timeout="20" >
            </forms>
        </authentication>
<!-- This section denies access to all files in this application except for those that you have not explicitly specified by using another setting. -->
        <authorization>
            <deny users="?" />
        </authorization>
    </system.web>
<!-- This section gives the unauthenticated user access to the Default1.aspx page only. It is located in the same folder as this configuration file. -->
        <location path="default1.aspx">
        <system.web>
        <authorization>
            <allow users ="*" />
        </authorization>
        </system.web>
        </location>
<!-- This section gives the unauthenticated user access to all of the files that are stored in the Subdir1 folder.  -->
        <location path="subdir1">
        <system.web>
        <authorization>
            <allow users ="*" />
        </authorization>
        </system.web>
        </location>
</configuration>






我已经做到了,但我想让您满意并开始






IHAVE DONE THAT BUT I WANT YOUR OPENION AND SOUUTION

推荐答案

您可以按照以下步骤操作.

1.选择并实施一种身份验证模式.
2.如下所示定义授权级别.

You may follow the steps below.

1. Choose and Implement one of the authentication mode.
2. Define authorization levels as shown below.

<configuration>
    <system.web>
        <authentication mode="Forms" >
            <forms loginUrl="login.aspx" name=".ASPNETAUTH" protection="None" path="/" timeout="20" >
            </forms>
        </authentication>
<!-- This section denies access to all files in this application except for those that you have not explicitly specified by using another setting. -->
        <authorization>
            <deny users="?" />
        </authorization>
    </system.web>
<!-- This section gives the unauthenticated user access to the Default1.aspx page only. It is located in the same folder as this configuration file. -->
        <location path="default1.aspx">
        <system.web>
        <authorization>
            <allow users ="*" />
        </authorization>
        </system.web>
        </location>
<!-- This section gives the unauthenticated user access to all of the files that are stored in the Subdir1 folder.  -->
        <location path="subdir1">
        <system.web>
        <authorization>
            <allow users ="*" />
        </authorization>
        </system.web>
        </location>
</configuration>



3.另一种方法是将aspx文件分组到
文件夹,取决于它们的授权级别.
3.使用
为每个文件夹分别设置web.config



3. Another way is to group the aspx files to
folders depending on their authorization level.
3. Have separate web.config for each of the folders with

<system.web>
        <authorization>
            <allow users ="*" />
        </authorization>
        </system.web>



干杯
Balaji



Cheers
Balaji


您需要在基类中构建授权系统,并从该基类派生需要登录的页面.基类将检查会话变量以查看用户是否已登录,如果没有登录,则重定向到登录页面.
You need to build an authorisation system in a base class, and derive your pages that need log in, from that base class. The base class would check a session variable to see if the user is logged in, and, if not, redirect to the login page.


这篇关于使用c Sharp 3对某些页面进行授权的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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