<feed xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns="http://www.w3.org/2005/Atom" xml:lang="en-US">
    <title>A Developer's Expedition</title>
    <link rel="self" type="application/xml" href="http://geekswithblogs.net/kenl/Atom.aspx" />
    <subtitle type="html">www.kenl.net</subtitle>
    <id>http://geekswithblogs.net/kenl/Default.aspx</id>
    <author>
        <name>Ken Lovely, MCSE, MCDBA, MCTS</name>
        <uri>http://geekswithblogs.net/kenl/Default.aspx</uri>
    </author>
    <generator uri="http://subtextproject.com" version="Subtext Version 0.0.0.0">Subtext</generator>
    <updated>2009-07-23T19:37:35Z</updated>
    <entry>
        <title>Operation SSL Mode</title>
        <link rel="self" type="text/html" href="http://geekswithblogs.net/kenl/archive/2009/07/23/operation-ssl-mode.aspx" />
        <id>http://geekswithblogs.net/kenl/archive/2009/07/23/operation-ssl-mode.aspx</id>
        <published>2009-07-23T19:37:35-12:00:00</published>
        <updated>2009-07-23T19:37:35Z</updated>
        <content type="html">&lt;div style="MARGIN: 0in 0in 0pt"&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt; &lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt;I had to make our site work in SSL mode and ONLY SSL mode. I also had to allow url's that pointed to our site before I forced it work in secure mode. I also had to allow for all the other domain names that we own work in SSL mode. &lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt;I thought I would share how to get this done right so no matter what it works.&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt; &lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt;Create an HTML page named 403-4.htm. Put it in a folder outside your web site’s root folder. Give the page your company’s logo and some nice looking text that states;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt; &lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt;The page must be viewed over a secure channel&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt;The page you are trying to access is secured with Secure Sockets Layer (SSL).&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt; &lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt;If you are not automatically redirected to our secure site, please click on this link;   &amp;lt;add your link&amp;gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt; &lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt;Now you are done with the basics; let’s do some scripting&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt; &lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="COLOR: blue; FONT-SIZE: 10pt"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515; FONT-SIZE: 10pt"&gt;script&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt"&gt; &lt;span style="COLOR: red"&gt;type&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="text/javascript"&amp;gt;&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt; &lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="COLOR: blue; FONT-SIZE: 10pt"&gt;function&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt"&gt; goSSL() &lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="FONT-SIZE: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt; &lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="COLOR: blue; FONT-SIZE: 10pt"&gt;var&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt"&gt; myDomain = window.location.hostname;&lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt; &lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="COLOR: green; FONT-SIZE: 10pt"&gt;// Add your domain name here&lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="COLOR: green; FONT-SIZE: 10pt"&gt;// This variable is used to ensure the domain with the &lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="COLOR: green; FONT-SIZE: 10pt"&gt;// SSL cert is always called&lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="COLOR: blue; FONT-SIZE: 10pt"&gt;if&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt"&gt; (myDomain != &lt;span style="COLOR: #a31515"&gt;"www.mydomain.com"&lt;/span&gt;) {&lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="FONT-SIZE: 10pt"&gt;    myDomain = &lt;span style="COLOR: #a31515"&gt;"www.domain.com"&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="FONT-SIZE: 10pt"&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt; &lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="COLOR: green; FONT-SIZE: 10pt"&gt;// This variable is used to extract the url the user &lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="COLOR: green; FONT-SIZE: 10pt"&gt;// entered the site with&lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="COLOR: blue; FONT-SIZE: 10pt"&gt;var&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt"&gt; unsecure = myDomain + window.location.pathname; &lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="COLOR: blue; FONT-SIZE: 10pt"&gt;var&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt"&gt; secure = &lt;span style="COLOR: #a31515"&gt;""&lt;/span&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt; &lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="COLOR: green; FONT-SIZE: 10pt"&gt;// This was my original comparison&lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="COLOR: green; FONT-SIZE: 10pt"&gt;// it just always forced the user has the www.&lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="COLOR: green; FONT-SIZE: 10pt"&gt;// I left it but you could change the secure var&lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="COLOR: green; FONT-SIZE: 10pt"&gt;// above to have the https:// portion since&lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="COLOR: green; FONT-SIZE: 10pt"&gt;// the myDomain var is set...&lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="COLOR: blue; FONT-SIZE: 10pt"&gt;if&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt"&gt;(unsecure.substring(0,3) != &lt;span style="COLOR: #a31515"&gt;"www"&lt;/span&gt;) {&lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="FONT-SIZE: 10pt"&gt;      secure = &lt;span style="COLOR: #a31515"&gt;"https://www."&lt;/span&gt; + unsecure;&lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="FONT-SIZE: 10pt"&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="COLOR: blue; FONT-SIZE: 10pt"&gt;else&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt"&gt; {&lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="FONT-SIZE: 10pt"&gt;      secure = &lt;span style="COLOR: #a31515"&gt;"https://"&lt;/span&gt; + unsecure;&lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="FONT-SIZE: 10pt"&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt; &lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="COLOR: green; FONT-SIZE: 10pt"&gt;// Just incase the user had a query string&lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="FONT-SIZE: 10pt"&gt;query = &lt;span style="COLOR: #a31515"&gt;''&lt;/span&gt; + window.location; &lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="FONT-SIZE: 10pt"&gt;position = query.indexOf(&lt;span style="COLOR: #a31515"&gt;'?'&lt;/span&gt;); &lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="COLOR: blue; FONT-SIZE: 10pt"&gt;if&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt"&gt; (position &amp;gt; -1) &lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="FONT-SIZE: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="FONT-SIZE: 10pt"&gt;      query = query.substring(position + 1); &lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="FONT-SIZE: 10pt"&gt;      secure = secure + &lt;span style="COLOR: #a31515"&gt;"?"&lt;/span&gt; + query; &lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="FONT-SIZE: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt; &lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="COLOR: green; FONT-SIZE: 10pt"&gt;// open the window to the newly set url&lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="FONT-SIZE: 10pt"&gt;window.location = secure; &lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="FONT-SIZE: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt; &lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="COLOR: blue; FONT-SIZE: 10pt"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515; FONT-SIZE: 10pt"&gt;script&lt;/span&gt;&lt;span style="COLOR: blue; FONT-SIZE: 10pt"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt; &lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt;Setting up IIS:&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt; &lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt;Open IIS and go to the properties of your web site&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt;Click on the security tab&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt;Click on Edit under Secure Communications&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt;                I am assuming you already have an ssl cert on the site!&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt;Check the require secure channel box&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt;Check the require 128 bit encryption box&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt;Click OK&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt;Click on the Custom Error's tab&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt;Click on the 403;4 error &lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt;Click on Edit and point to the file you made above&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt;Click OK&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt;Click OK&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt; &lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt;Using this technique every domain you have pointed to this web site will be forced to use your secure SSL domain. The user will be presented with a quick flash of a page telling them that the site is secure for their safety.&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt; &lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt"&gt;The next secure web page you go to try changing the page back to http – this technique will put the page right back to the page the user was at and securely.&lt;/div&gt;&lt;img src="http://geekswithblogs.net/kenl/aggbug/133680.aspx" width="1" height="1" /&gt;</content>
        <wfw:comment>http://geekswithblogs.net/kenl/comments/133680.aspx</wfw:comment>
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://geekswithblogs.net/kenl/comments/commentRss/133680.aspx</wfw:commentRss>
        <trackback:ping>http://geekswithblogs.net/kenl/services/trackbacks/133680.aspx</trackback:ping>
    </entry>
</feed>