kamagra how much to take

Determine If SharePoint Context Is Secure (SSL)

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:

  1. if (!HttpContext.Current.Request.IsSecureConnection)
  2. {
  3. string newUrl = "https://" + Request.Url.Host + Request.Url.PathAndQuery;
  4. Response.Redirect(newUrl, true);
  5. return;
  6. }

or you can write an error message if it is false:

  1. if(HttpContext.Current.Request.IsSecureConnection == false)
  2. {
  3. string message = "You should use HTTPS to avoid sending
  4. passwords in clear text";
  5. HttpContext.Current.Trace.Warn(message);
  6. throw new InvalidOperationException(message);
  7. }
Share

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>