1. Create a region 82
2. Set membershipprovider
Code
Public Override Bool Validateuser ( String Username, String Password)
{
If (Username = " Guest " )
Return True ;
Else
Return False ;
}
Public Override Membershipuser getuser ( String Username, Bool Userisonline)
{
If (Username = " Guest " )
Return New Membershipuser ( This . Name, " Guest " , " Guest " , String . Empty, String . Empty, String . Empty, True , False , Datetime. minvalue );
Return Null ;
}
Public Override Membershipusercollection getallusers ( Int Pageindex, Int Pagesize, Out Int Totalrecords)
{
Totalrecords = 1 ;
Membershipusercollection usercollection = New Membershipusercollection ();
Usercollection. Add ( New Membershipuser ( This . Name, " Guest " , " Guest " , String . Empty, String . Empty, String . Empty, True , False , Datetime. minvalue ));
Return Usercollection;
}
Public Override Membershipusercollection findusersbyname ( String Usernametomatch, Int Pageindex, Int Pagesize, Out Int Totalrecords)
{
If ( String . Format ( " Guest " ). Contains (usernametomatch ))
Return Getallusers ( 1 , 1 , Out Totalrecords );
Else
{
Totalrecords = 0 ;
Return New Membershipusercollection ();
}
}
3. Configure the 82 site as anonymous access and set membershipprovider
4. Change the 82 global. ashx File
Code
1 < Script runat = ' Server ' >
2 Protected Void Application_authenticaterequest (Object sender, eventargs E)
3 {
4 String Cookiename = Formsauthentication. formscookiename;
5 Httpcookie authcookie = Context. Request. Cookies [cookiename];
6 If (Authcookie = Null )
7 {
8 Formsauthentication. setauthcookie ( " Guest " , False );
9 }
10 }
11 </ Script >