Subject: This property can not be set for anonymous users
Posted By: everest Post Date: 10/30/2007 8:27:10 PM
Guys,
I am getting this error once in a while : System.Configuration.Provider.ProviderException: This property cannot be set for anonymous users.

any help is appreciated

when user tries to log in, once user name and password is authenticated in database, I execute following code to set the profile

FormsAuthentication.SetAuthCookie(userName, false);
System.Security.Principal.GenericIdentity identity  = new System.Security.Principal.GenericIdentity(userName);
        System.Security.Principal.GenericPrincipal user = new System.Security.Principal.GenericPrincipal(identity, null);
        Context.User = user;
        SqlDataReader dr = myDB.GetUserInformation(userName);
        if (dr.Read())
        {
            Profile.FirstName = dr["FirstName"].ToString();
            Profile.LastName = dr["LastName"].ToString();            
        }
        dr.Close();
Reply By: everest Reply Date: 10/30/2007 8:28:30 PM
99% of the time, i don't get this error.
Reply By: jwize Reply Date: 4/19/2008 4:28:33 AM
99 % of the time you are logged in.


Tsik Man

Go to topic 68506

Return to index page 1