Umbraco: Remove currently login member from cache by c#.

In Umbraco when we add member to cache at the time of Login:

// Add memeber information to cache.
Member.AddMemberToCache("Nishant", true, new TimeSpan(0, timeOut, 0));

After that we want to remove member from cache for doing this Umbraco provide RemoveMemberFromCache() method. See below working example.

        /// <summary>
        /// Remove Member from cahce
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void RemoveMember_Click(object sender, EventArgs e)
            // Get currently login member information
            Member currentLogInMem = Member.GetCurrentMember();
            Member.RemoveMemberFromCache(currentLogInMem .Id);
            Member.ClearMemberFromClient(currentLogInMem .Id);

            // Redirect to Home page
            Response.Redirect("Home Page");

Hope this will help you 🙂


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s