<rss version="2.0" 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:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>A Developer's Expedition</title>
        <link>http://geekswithblogs.net/kenl/Default.aspx</link>
        <description>www.kenl.net</description>
        <language>en-US</language>
        <copyright>Ken Lovely, MCSE, MCDBA, MCTS</copyright>
        <managingEditor>ken.lovely@kenl.net</managingEditor>
        <generator>Subtext Version 0.0.0.0</generator>
        <image>
            <title>A Developer's Expedition</title>
            <url>http://geekswithblogs.net/images/RSS2Image.gif</url>
            <link>http://geekswithblogs.net/kenl/Default.aspx</link>
            <width>77</width>
            <height>60</height>
        </image>
        <item>
            <title>Operation SSL Mode</title>
            <link>http://geekswithblogs.net/kenl/archive/2009/07/23/operation-ssl-mode.aspx</link>
            <description>&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;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=133680"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=133680" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/kenl/aggbug/133680.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Ken Lovely, MCSE, MCDBA</dc:creator>
            <guid>http://geekswithblogs.net/kenl/archive/2009/07/23/operation-ssl-mode.aspx</guid>
            <pubDate>Fri, 24 Jul 2009 07:37:35 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/kenl/comments/133680.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/kenl/archive/2009/07/23/operation-ssl-mode.aspx#feedback</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>
        </item>
    </channel>
</rss>