Page 1 of 1

Favicon Issue on HTTPS

Posted: Mon Jan 19, 2015 4:28 am
by CGrouse
We recently switched the full site to HTTPS and since then, our error log has been filling up with this message:

An error has occured at https://www.firefold.com/favicon.ico
Exception: Index and length must refer to a location within the string. Parameter name: length Stack Trace: at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy) at CommerceBuilder.Services.MobileDetection.IsMobileDevice(String userAgent) at CommerceBuilder.Services.MobileDetection.GetBrowserCapabilities(HttpRequest request) at System.Web.Configuration.HttpCapabilitiesBase.GetBrowserCapabilities(HttpRequest request) at System.Web.HttpRequest.get_Browser() at System.Web.Security.CookielessHelperClass.UseCookieless(HttpContext context, Boolean doRedirect, HttpCookieMode cookieMode) at System.Web.Security.FormsAuthenticationModule.ExtractTicketFromCookie(HttpContext context, String name, Boolean& cookielessTicket) at System.Web.Security.FormsAuthenticationModule.OnAuthenticate(FormsAuthenticationEventArgs e) at System.Web.Security.FormsAuthenticationModule.OnEnter(Object source, EventArgs eventArgs) at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

The favicon appears to be working properly. Any idea what might be causing this?

Re: Favicon Issue on HTTPS

Posted: Mon Jan 19, 2015 5:43 am
by mazhar
Which version of Gold is this ? There was an issue with Mobile Detection logic similar to this which was fixed a while ago. The issue which was fixed due to empty user agent.

Re: Favicon Issue on HTTPS

Posted: Mon Jan 19, 2015 7:12 am
by CGrouse
AbleCommerce Gold (build 5731)

Re: Favicon Issue on HTTPS

Posted: Mon Jan 19, 2015 7:21 am
by mazhar
[AC8-2517] - null key exception when user agent is null
This was fixed in Gold R8. It was happening due to empty/null user agent.

Re: Favicon Issue on HTTPS

Posted: Mon Jan 19, 2015 9:11 am
by CGrouse
I don't foresee us upgrading anytime soon, as we have quite a bit of customization going on. Is there a fix we can apply?

Re: Favicon Issue on HTTPS

Posted: Tue Jan 20, 2015 12:17 am
by mazhar
Since you mentioned about customization, do you have back end source code and customized it or they are just front end custom codes? If you are already working against back end codes for customization then I can provide you with instructions to get it fixed in source.

Re: Favicon Issue on HTTPS

Posted: Tue Jan 20, 2015 4:10 am
by CGrouse
We have full source code and both front and back ends have customizations.

Re: Favicon Issue on HTTPS

Posted: Tue Jan 20, 2015 5:48 am
by mazhar
Edit CommerceBuilder.Services.MobileDetection.cs file and locate following line of code

Code: Select all

return _mobileAgents1.IsMatch(userAgent) || _mobileAgents2.IsMatch(userAgent.Substring(0, 4));
and update it like

Code: Select all

return _mobileAgents1.IsMatch(userAgent) || (userAgent.Length > 4 && _mobileAgents2.IsMatch(userAgent.Substring(0, 4)));