Hi, got an SSL certificate installed by host today but after setting <add key="UseSSL" value="True" /> in web.config I can't access any pages or links to pages using https:// - I found the following solutions:
But not being a dev (& not being very bright) I can't for the life of me figure out where the 'CommonHelper' class/CommonHelper.cs is so I can try the solutions.
Can anyone tell me where to find the 'CommonHelper' class? & once I 've changed it do I need to do anything like recompile the whole site?
OK I've changed EnsureSSL function as per codewarrior's solution here: https://www.nopcommerce.com/boards/t/1093/redirect-loop.aspx?p=2 and changed the server variable to read ["HTTP_X_FORWARDED_PROTO"] as it should for my server host.
Now When I rebuild nop.Common I get the following error:
Error 1 The name 'SettingManager' does not exist in the current context I:\1_inklabs™\_ct11_pre01\SITE_FILES_PRE\nopCommerce_1.90_Source\Libraries\Nop.Common\Utils\CommonHelper.cs 690 21 Nop.Common
Can anyone tell me what i'm doing wrong and how I can fix it?
Just looked at the forum post you referenced. It's about some old nopCommerce version. If you're using 1.90, try the next steps: 1. Open CommonHelper.cs file 2. Find the following line of code and uncomment it
Ok, that's easier :) - it compiled fine with no errors. However it doesn't appear to have solved HTTPS redirect/loop problem. As soon as add key="UseSSL" value is set to true and application pool recycled on server accessing https pages/links still returns the same old errors in the browser.
The Errors I'm still getting:
[Safari] This web page has a redirect loop The web page at https://mydomain/login.aspx has resulted in too many redirects. Clearing your cookies for this site or allowing third-party cookies may fix the problem. If not, it is possibly a server configuration issue and not a problem with your computer.
[FF] The page isn't redirecting properly Firefox has detected that the server is redirecting the request for this address in a way that will never complete.
TO RECAP WHAT I'VE DONE:
1) IN CommonHelper.cs I have set the following@ Line 334 (server variable details from my host - http://forums.tsohost.co.uk/clustered-hosting-platform-windows-hosting/747-ssl-detection.html)
public static bool IsCurrentConnectionSecured() { bool useSSL = false; if (HttpContext.Current != null && HttpContext.Current.Request != null) { //useSSL = HttpContext.Current.Request.IsSecureConnection; //when your hosting uses a load balancer on their server then the Request.IsSecureConnection is never got set to true, use the statement below //just uncomment it useSSL = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_PROTO"] == "on" ? true : false; }
return useSSL; }
2) I have compiled the solution, checked date/time of Nop.Common.DLL & uploaded to server. 3) I set <add key="UseSSL" value="True" /> in web.config 4) I recycle application pool on server
OK, it would appear uncommenting the line: useSSL = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_PROTO"] == "on" ? true : false; is for sharedSSL!
I need to look for the header ["HTTP_X_FORWARDED_PROTO"] so have tried: