How to disable forcing SSL for localhost debug?

5 years ago
I've installed SSL on my web server for my published nop site.  In production SSL is working exactly as I would expect it to and there are no issues there.  I currently have the option to force SSL on all pages turned on.

Now when I attempt to debug my nopCommerce source code on localhost outside of the admin area it tries to force localhost to https and I end up with an "SSL connection error" message.  Perhaps somewhat oddly, I don't have any problems viewing admin pages on localhost.

Is there a way to create some kind of exception so I don't have to deal with SSL when debugging my Solution from Visual Studio?

Thanks.
5 years ago
Looks like I was able to fix this by inserting a line of code into the OnAuthorization method in class NopHttpsRequirementAttribute under the if clause testing if the action is a child method.

The code added:
if (filterContext.HttpContext.Request.Url.Host.Contains("localhost")) return;
5 years ago
Thanks. This helped me keep some hair on my head. I had changed my site location in the store from the localhost setting when I first installed it to the live site with the http and https and when I tried to debug in Visual Studio it then kept bring me to the live site. I tried changing the setting back in the administration section and I still couldn't debug (still sending me to the live site and never triggering your code).  Then I switched browsers from FireFox to Chrome and it worked. It must be a cookie issue.
5 years ago
Glad it helped.  

Forgetting about cached browser content has caused me more headaches than I can count.
1 year ago
[email protected] wrote:
Looks like I was able to fix this by inserting a line of code into the OnAuthorization method in class NopHttpsRequirementAttribute under the if clause testing if the action is a child method.

The code added:
if (filterContext.HttpContext.Request.Url.Host.Contains("localhost")) return;



This worked for me too... finally!!! Thank you
1 year ago
hemilis wrote:
Looks like I was able to fix this by inserting a line of code into the OnAuthorization method in class NopHttpsRequirementAttribute under the if clause testing if the action is a child method.

The code added:
if (filterContext.HttpContext.Request.Url.Host.Contains("localhost")) return;



This worked for me too... finally!!! Thank you

This work for me..thank you
1 year ago
If you're using visual studio and local IIS then there's an option to enable HTTPS in it - see http://dailydotnettips.com/2014/01/27/enabling-ssl-with-iis-express-in-visual-studio/
10 months ago
In Chrome:
1. Open DevTools
2. Click and hold the reload button (left of url address bar) to see more options.
3. Select "Empty Cache and Hard Reload"

https://developers.google.com/web/updates/2015/05/hard-reload