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