666 users online

Switching SSL

Posted: 3 months ago Quote
Hi,

I need nopCommerce to direct some pages to non-SSL, when I turn SSL on. Is there a way to do this? If so, is there a way without altering the source code?

For example, I always want the home page and products in non-SSL.
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Posted: 3 months ago Quote
Just add the following attribute to required action methods or controllers:
[NopHttpsRequirement(SslRequirement.No)]
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Andrei Mazoulnitsyn,
LinkedIn - http://ru.linkedin.com/in/mazoulnitsyn

Twitter - http://twitter.com/#!/nopCommerce
Facebook community page - http://www.facebook.com/pages/NopCommerce/108282972527146
Google+ page - https://plus.google.com/100073150079669136049
Posted: 3 months ago Quote
Hi,

Thanks, but can I do this without altering the source code?
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Posted: 3 months ago Quote
Hi,

I got this to work in the .cshtml files:


    if (Request.IsSecureConnection)
    {
        Response.Redirect(Request.Url.ToString().Replace("https", "http"));
    }

Here is one where I used it:

\Views\Catalog\ProductTemplate.SingleVariant.cshtml
This post/answer is useful
1
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Posted: 3 months ago Quote
joe_a84 wrote:
Hi,

I got this to work in the .cshtml files:


    if (Request.IsSecureConnection)
    {
        Response.Redirect(Request.Url.ToString().Replace("https", "http"));
    }

Here is one where I used it:

\Views\Catalog\ProductTemplate.SingleVariant.cshtml


Thanks for the code,
I was having trouble with sessions not being carried over from non-secure to secure (so when an anonymous user added an item to their cart, their cart would be empty).

I modified the code to
@{    if (Request.IsSecureConnection==false)
    {
        Response.Redirect(Request.Url.ToString().Replace("http", "https"));
    }
}
and placed in the variantsingrid file also.
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Leave the day better than you found it.

Jacob Brown
dfwitdepartment.com
Disclaimer: I'm self taught and just figure things out, although I've read books and consider myself pretty smart- there maybe a better way about doing it.
Posted: 2 months ago Quote
a.m. wrote:
Just add the following attribute to required action methods or controllers:
[NopHttpsRequirement(SslRequirement.No)]


Where is that staff? I am not programmer :( I also want our customers enter in secure enviroment inly during checkout in 2.4

Also, when I am entering categories, something is strange. If category do not have products, it is in secure environment. When there is any product, even no pictures, just one word, it is out of secure environment. Product itself is in secure environment.  Microsoft Explorer did not show any broken links, so I do not know where is that staff that brakes SSL.
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Posted: 2 months ago Quote
What I really want is customers get https only when they enter checkout. Not the store itself completely,
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Posted: 2 months ago Quote
Hi - Yes have experienced the same issues. seems a little strange - version 2.x and the whole site stays in ssl regardless of the settings. this seems very strange that you can only have the whole site with ssl as default  and cannot get these to be selected as default.. some major code rework ahead I feel. With a quick code read it seems the correct controllers are labled to be linked with ssl... BUT ssl is always enabled..any help with this is greatly received. I see this as a fundamental flaw with NOP.
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Posted: 2 months ago Quote
This can get a bit tricky since everyone has different preferences in how to handle this.  I would, however suggest that the homepage be coded to redirect to non secure.  That would at least minimize the issue and give people an out that is expected on the secure side.
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Steve Christensen
Superior IRON-ARTz LLC
Where industry and art collide!
http://www.IRON-ARTz.com