Revindex Storefront

Export Print

How to cleanup on logout

By default, Revindex Storefront will automatically clear the cart when a registered user logs out from your site. This security measure prevents other users sharing the same computer from viewing the cart items of another user.

If you want to perform additional clean up tasks after a user logs out, you can do so using a special page that will be redirected after logout by following the steps below:

  1. Give your page a name e.g. "Logout".
  2. Uncheck the Include in Menu checkbox.
  3. Set the page permission to allow only "Unauthenticated Users".
  4. Click Update to save.
  5. On the newly created page, add the Razor Host module to the page.
  6. On the action menu, click Edit script.
  7. Click Add new script file.
  8. Choose "CSHTML (C#)" file type.
  9. Give it a file name (e.g. "Logout.cshtml")
  10. Click Add new script.
  11. Select the script you created. It may have an underscore prefix to the name.
  12. Replace the Script Source with this code:

      // Perform your steps here such as expiring cookie, closing session, clear cache, etc.
      Response.Cookies.Add(new HttpCookie("ASP.NET_SessionId", ""));
      Response.Cookies.Add(new HttpCookie("rvdsfcart|0", "") { Expires =  DateTime.Now.AddDays(-1d) });

      // Uncomment the line below if you want to redirect to your home page.
      // Warning: Once you uncomment it, you won't be able to access this page
      // anymore since it will redirect immediately.
      // You will have to go to your local folder to edit this script
      // under DesktopModules\RazorModules\RazorHost\Scripts\<file>.cshtml.
      // Response.Redirect("~/", false);

  13. Check on the Is Active checkbox.
  14. Click Save Script and Return.
  15. Go to your Admin > Site Settings page.
  16. Under the User Accounts Settings tab, change the Redirect After Logout dropdown to your newly created page.
  17. Click Update.


Add comment

Powered by Revindex Wiki