5

I am logging in user as virtual user to Sitecore. For some reason default wallpaper for user is blue screen instead of default Sitecore field image. enter image description here if I update wallpaper manually via dialog it save value somewhere and show correct wallpaper even for next login. enter image description here

I tried this code. It works for common Sitecore user but does not work virtual user.

 virtualUser.Profile.SetCustomProperty("Wallpaper", "/sitecore/shell/themes/backgrounds/Field.jpg");

How can I setup wallpaper for virtual user? (Sitecore 8.2)

4
  • can you try to virtualUser.Profile.Save() after virtualUser.Profile.SetCustomProperty(...)? Commented Dec 2, 2019 at 12:49
  • @TamásTárnok yes. it did not help.
    – Vlad
    Commented Dec 2, 2019 at 12:50
  • Does it happen right away? virtual user client data gets flushed, every 4 hours by default. <agent type="Sitecore.Tasks.CompactClientDataAgent" method="Run" interval="04:00:00"/>
    – Mark Cassidy
    Commented Dec 2, 2019 at 13:05
  • @MarkCassidy yes. it does not show me default field image immediately after login.
    – Vlad
    Commented Dec 2, 2019 at 14:52

1 Answer 1

6

The problem could be is that you are using the following:

virtualUser.Profile.SetCustomProperty("Wallpaper", "/sitecore/shell/themes/backgrounds/Field.jpg")

Try to use the following:

virtualUser.Profile["Wallpaper"] = "/sitecore/shell/themes/backgrounds/Field.jpg"

Explanation

The SetCustomProperty does not check if the user is virtual user or not, but the [] checks it and it saves into the user.RuntimeSettings.Properties if the user is virtual.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.