API
Version 7.x > API > Broken images in IE print preview after authentification using API View modes: 
User avatar
Member
Member
fbomke-sitrion - 8/27/2013 10:03:55 AM
   
Broken images in IE print preview after authentification using API
I'm using the following code in order to authentificate a user programatically in Kentico CMS 7.x:
CMS.SiteProvider.UserInfo ui = AuthenticationHelper.AuthenticateUser("user", "password", CMS.CMSHelper.CMSContext.CurrentSite.SiteName);

if (ui != null)
{
System.Web.Security.FormsAuthentication.SetAuthCookie(ui.UserName, true);
CMS.CMSHelper.CMSContext.SetCurrentUser(new CMS.CMSHelper.CurrentUserInfo(ui, true));
CMS.SiteProvider.UserInfoProvider.SetPreferredCultures(ui);


if (Request.QueryString["Pagename"] != null) {

Response.Redirect(Request.QueryString["Pagename"] + ".aspx");
}

else {
Response.Redirect("/LoggedIn.aspx");
}

}
else
{
Response.Redirect("/Login.aspx");
}

Everthing seems to be working just fine. There's still one problem. When using the Internet Explorer (other browsers are working fine) and opening the print preview (and actual print) all attached images are displayed as broken links.
I double-checked user security settings by logging in with the same user using the standard logon form - everthing's fine...

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 8/27/2013 1:38:12 PM
   
RE:Broken images in IE print preview after authentification using API
Are you able to validate the URLs for the images are correct nd aren't being cached by the browser(s)?

User avatar
Member
Member
fbomke-sitrion - 8/28/2013 2:02:09 AM
   
RE:Broken images in IE print preview after authentification using API
The images are not cached in IE (cleared the cache a couple of times). I also tried different browsers (Firefox, Safari, etc.).
None of them has this issue. It only happens when I log on using the api. When I log on using the regular logon form with the same user, everything's fine...

User avatar
Member
Member
kentico_sandroj - 9/2/2013 2:50:21 PM
   
RE:Broken images in IE print preview after authentification using API
Hello,

Could you please confirm which version and hotfix the site in question is running? Also, which version of IE are you using? Additionally, what are your cache settings?

I used the code you provided in v7.0.51 with IE7, IE8, IE9 & IE10 and the images loaded correctly after authentication. Do you see the same behavior on other boxes running IE?

User avatar
Member
Member
fbomke-sitrion - 9/3/2013 4:04:02 AM
   
RE:Broken images in IE print preview after authentification using API
Hello,
I'm using 7.0.4640. I will also try the latest hotfix.

Just to avoid any misunderstandings: The images load correctly in the browser.
It only happens when I click on print > print preview or when i simply print the page and only in IE.

I tested tested all major IE Versions from IE7 up to IE 11 beta, also on different machines.

User avatar
Member
Member
kentico_sandroj - 9/3/2013 11:41:26 AM
   
RE:Broken images in IE print preview after authentification using API
Hello,

Thank you for the additional clarification. I just made sure that the print preview looks the same in all browsers including IE, would it be possible to upload an image that compares the two print previews? FireFox and IE for example.

User image