Image URL contains sitecore/shell path in specific situation

802 views
Skip to first unread message

Pascal Mathys

unread,
Jun 30, 2014, 5:54:37 AM6/30/14
to glasssite...@googlegroups.com
Hello,

I found a problem in our solution. We map the Website Logo with Glass.Mapper and the Image field. For the image url we use the Image.Src property.

Normally, the url is correct (Say: http://glass.local/-/media/themedia.jpg)

If i do the following, the url gets created within the shell context and is not accessible as an normal visitor:

1. Restart IIS
2. Log in to Sitecore with /sitecore/login -> This must be the first action after restarting
3. Open the Website which contains the image

When you open another browser or start a private session, the URL will still have /sitecore/shell in it. This does not work for a visitor. 

When i open the website after an IIS reset as a normal user without login, the URL gets generated correct and works in any case. I created the following log statement:
 
Log.Info(string.Format("Src from Image.Src: {0}, Generated by GetMediaUrl: {1}", this.Image.Src , MediaManager.GetMediaUrl(new MediaItem(Sitecore.Context.Database.GetItem(new ID(this.Image.MediaId))))), this);

This shows me that the on the fly generation of the url is correct, the Src property not. Seems that Glass caches the Image after it's first call.

Can you help me with this?
Message has been deleted

Pascal Mathys

unread,
Jul 4, 2014, 7:12:27 AM7/4/14
to glasssite...@googlegroups.com
As this seems to be a bug or unexpected behavior, i created a Issue on Github: https://github.com/Glass-lu/Glass.Sitecore.Mapper/issues/66

Thomas Paterno

unread,
Jan 31, 2015, 5:17:39 PM1/31/15
to glasssite...@googlegroups.com


On Friday, July 4, 2014 at 7:12:27 AM UTC-4, Pascal Mathys wrote:
As this seems to be a bug or unexpected behavior, i created a Issue on Github: https://github.com/Glass-lu/Glass.Sitecore.Mapper/issues/66


Pascal, Did you ever resolve this issue?  I am dealing with the same problem.  Thanks.  Tom

Pascal Mathys

unread,
Feb 2, 2015, 3:08:14 AM2/2/15
to glasssite...@googlegroups.com
Hi Thomas,

Yes, but the problem was self-made. I had some sort of custom cache which contained the Image object. If the first hit was within the Page Editor, the Image object got mapped with /sitecore/shell in it. Every subsequent call reused this object instead of a new mapping of the Image. After changing this behaviour, everything worked.

Thomas Paterno

unread,
Feb 2, 2015, 2:02:35 PM2/2/15
to glasssite...@googlegroups.com
Thanks Pascal
Reply all
Reply to author
Forward
0 new messages