Membership role and permission management [5]

Source: Internet
Author: User

Now, we can test the effect.

{
If (! This. resized) {return false;} else {window. Open ('attachments/2007/4/27/loginviewanonymoustemplvw7_nk9secmudkpd.gif ');}
} "Src =" http://www.blueidea.com/articleimg/2007/04/4676/loginviewanonymoustemplvw7_nK9SecMudkPD.gif "alt =" "width =" 359 "Height =" 136 ">

 

 

We can see that we have not logged on yet, and the anonymoustemplate content is displayed in front of us. Loginstatus displays the "Logon" status. Let's log on, register a user, and log on.

 

{
If (! This. resized) {return false;} else {window. Open ('attachments/2007/4/27/loginviewanonymoustemplvw7_nk9secmudkpd.gif ');}
} "Src =" http://www.blueidea.com/articleimg/2007/04/4676/loginviewmemberoj0_Zqn9MaPvZ9Sq.gif "alt =" "width =" 360 "Height =" 170 ">

Loggedintemplate does not work, but the Member role Template takes effect. This is because, in fact, we set it in createuserwizard, and the new user is directly included in the member role group after registration. Add a simple sentence to the createduser event of createuserwizard:

Protected void createuserwizardinclucreateduser (Object sender, eventargs E)
{
Roles. addusertorole (createuserwizard1.username, "member ");
}

Let's explain the above "you can visit ......" What does it mean. Before that, I have actually added two roles: Member and Admin. To add a role, choose website> ASP. NET configuration> Security> Create or manage a role in vs2005. With the above cooperation, we add a role named "admin ".

{
If (! This. resized) {return false;} else {window. Open ('attachments/2007/4/27/loginviewanonymoustemplvw7_nk9secmudkpd.gif ');}
} "Src =" http://www.blueidea.com/articleimg/2007/04/4676/003.jpg "alt =" "width =" 510 "Height =" 284 ">

Then select "create access rule" to create an access rule. Create the following rule for the admin file, as shown in:

{
If (! This. resized) {return false;} else {window. Open ('attachments/2007/4/27/loginviewanonymoustemplvw7_nk9secmudkpd.gif ');}
} "Src =" http://www.blueidea.com/articleimg/2007/04/4676/004.jpg "alt =" "width =" 510 "Height =" 204 ">

The member group and anonymous users are denied. Only users in the admin group can access the admin folder. Create the following access rules for the user folder.

{
If (! This. resized) {return false;} else {window. Open ('attachments/2007/4/27/loginviewanonymoustemplvw7_nk9secmudkpd.gif ');}
} "Src =" http://www.blueidea.com/articleimg/2007/04/4676/005.jpg "alt =" "width =" 510 "Height =" 212 ">

Reject anonymous users and allow users in the member and Admin groups.

After the newly registered users log on, they can access the files in the user folder.

{
If (! This. resized) {return false;} else {window. Open ('attachments/2007/4/27/loginviewanonymoustemplvw7_nk9secmudkpd.gif ');}
} "Src =" http://www.blueidea.com/articleimg/2007/04/4676/99loveuserca6_5bI7VW5a6eXG.gif "alt =" "width =" 373 "Height =" 203 ">

However, if you access the admin folder, it will be directed to the logon page.

{
If (! This. resized) {return false;} else {window. Open ('attachments/2007/4/27/loginviewanonymoustemplvw7_nk9secmudkpd.gif ');}
} "Src =" http://www.blueidea.com/articleimg/2007/04/4676/006.jpg "alt =" "width =" 510 "Height =" 167 ">

 

 

Classic forum discussion:
Http://bbs.blueidea.com/thread-2740354-1-1.html

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.