So I have two types of SharePoint environments, one is SSL enabled and another is not. Both are extended to use the same content databases, so have the same presentation layer content. This is a pretty common situation with SharePoint.
When writing WebParts for my environment, it was important that I compensated by writing a small method that would determine whether the HTTP context that SharePoint was running under was using a secure connection. In case you have to do the same thing, you can write method using the IsSecureConnection in order to determine if the HTTP connection uses secure sockets. You can either orchestrate the user to a SSL enabled sites if it is true:
string newUrl = “https://” + Request.Url.Host + Request.Url.PathAndQuery;
or you can write an error message if it is false:
if(HttpContext.Current.Request.IsSecureConnection == false)
string message = “You should use HTTPS to avoid sending
passwords in clear text”;
throw new InvalidOperationException(message);