<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" 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:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>freachable.net - SiteFinity</title>
    <link>http://freachable.net/</link>
    <description>Next generation's garbage</description>
    <language>en-us</language>
    <copyright>Hafthor Stefansson</copyright>
    <lastBuildDate>Fri, 02 Jul 2010 19:40:58 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.1.8102.813</generator>
    <managingEditor>blog@freachable.net</managingEditor>
    <webMaster>blog@freachable.net</webMaster>
    <item>
      <trackback:ping>http://freachable.net/Trackback.aspx?guid=8d67f8b6-b0e2-42c3-b28e-611c342a53f7</trackback:ping>
      <pingback:server>http://freachable.net/pingback.aspx</pingback:server>
      <pingback:target>http://freachable.net/PermaLink,guid,8d67f8b6-b0e2-42c3-b28e-611c342a53f7.aspx</pingback:target>
      <dc:creator>Hafthor Stefansson</dc:creator>
      <wfw:comment>http://freachable.net/CommentView,guid,8d67f8b6-b0e2-42c3-b28e-611c342a53f7.aspx</wfw:comment>
      <wfw:commentRss>http://freachable.net/SyndicationService.asmx/GetEntryCommentsRss?guid=8d67f8b6-b0e2-42c3-b28e-611c342a53f7</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">I wanted rounded corners, but with minimal
fuss. I'm using border-radius and variants (-moz, -webkit, -khtml) which is great,
except for on IE, but I found a DHTML behavior (<a href="http://code.google.com/p/curved-corner/">http://code.google.com/p/curved-corner/</a>)
that makes it so IE will appear to have these powers. The trouble is, I'm using SiteFinity
which, like any good CMS, has these virtual folders that don't exist in IIS and url
references to behaviors must be in the same directory.<br /><br />
To fix this, I wrote a quick HttpHandler to all me to capture requests for htc files
and serve them from any path.<br /><br />
Here's the source:<br /><pre><span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px;"><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">public</span><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">class</span> HtcAnywhereHandler
: IHttpHandler { <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">public</span> HtcAnywhereHandler()
{ } <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">public</span><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">bool</span> IsReusable
{ get { <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">return</span><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">false</span>;
} } <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">public</span><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">void</span> ProcessRequest(HttpContext
context) { FileInfo fi <span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;">=</span><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">new</span> FileInfo(context.Server.MapPath(<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"~/htc/"</span><span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;">+</span> context.Request.Url.Segments[context.Request.Url.Segments.Length <span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;">-</span> 1])); <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">if</span> (fi.Exists
&amp;&amp; fi.Extension.Equals(<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">".htc"</span>,
System.StringComparison.InvariantCultureIgnoreCase)) { context.Response.ContentType <span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;">=</span><span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"text/x-component"</span>;
context.Response.BinaryWrite(File.ReadAllBytes(fi.FullName)); } <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">else</span> context.Response.StatusCode <span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;">=</span> 404;
} }</span></pre>So now I have an /htc directory where I really store my behavior but
a request to /skljfsfcio/border-radius.htc will serve the /htc/border-radius.htc file.
Yay.<br /><br />
To make this work, you'll need to add an entry to the httpHandlers section in the
web.config<br /><br />
&lt;add verb="GET" path="*.htc" validate="false" type="HtcAnywhereHandler, HtcAnywhere"
/&gt;<br /><br />
Then you need to tell IIS to use ASP.NET for .htc files. Go to the web site properties,
Home Directory tab, [configuration...], add an application extension to C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll
for .htc, Limit to: "GET", and turn off verify that it exists.<br /><br />
The bummer for me was that in my html that border-radius.htc didn't end up working.
Sigh.<br /><p></p><img width="0" height="0" src="http://freachable.net/aggbug.ashx?id=8d67f8b6-b0e2-42c3-b28e-611c342a53f7" /></body>
      <title>Using HTC Behaviors in SiteFinity or other ASP.NET CMS</title>
      <guid isPermaLink="false">http://freachable.net/PermaLink,guid,8d67f8b6-b0e2-42c3-b28e-611c342a53f7.aspx</guid>
      <link>http://freachable.net/2010/07/02/UsingHTCBehaviorsInSiteFinityOrOtherASPNETCMS.aspx</link>
      <pubDate>Fri, 02 Jul 2010 19:40:58 GMT</pubDate>
      <description>I wanted rounded corners, but with minimal fuss. I'm using border-radius and variants (-moz, -webkit, -khtml) which is great, except for on IE, but I found a DHTML behavior (&lt;a href="http://code.google.com/p/curved-corner/"&gt;http://code.google.com/p/curved-corner/&lt;/a&gt;)
that makes it so IE will appear to have these powers. The trouble is, I'm using SiteFinity
which, like any good CMS, has these virtual folders that don't exist in IIS and url
references to behaviors must be in the same directory.&lt;br&gt;
&lt;br&gt;
To fix this, I wrote a quick HttpHandler to all me to capture requests for htc files
and serve them from any path.&lt;br&gt;
&lt;br&gt;
Here's the source:&lt;br&gt;
&lt;pre&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;public&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;class&lt;/span&gt; HtcAnywhereHandler
: IHttpHandler { &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;public&lt;/span&gt; HtcAnywhereHandler()
{ } &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;public&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;bool&lt;/span&gt; IsReusable
{ get { &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;return&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;false&lt;/span&gt;;
} } &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;public&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;void&lt;/span&gt; ProcessRequest(HttpContext
context) { FileInfo fi &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;new&lt;/span&gt; FileInfo(context.Server.MapPath(&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"~/htc/"&lt;/span&gt; &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;+&lt;/span&gt; context.Request.Url.Segments[context.Request.Url.Segments.Length &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;-&lt;/span&gt; 1])); &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;if&lt;/span&gt; (fi.Exists
&amp;amp;&amp;amp; fi.Extension.Equals(&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;".htc"&lt;/span&gt;,
System.StringComparison.InvariantCultureIgnoreCase)) { context.Response.ContentType &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; &lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"text/x-component"&lt;/span&gt;;
context.Response.BinaryWrite(File.ReadAllBytes(fi.FullName)); } &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;else&lt;/span&gt; context.Response.StatusCode &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; 404;
} }&lt;/span&gt;&lt;/pre&gt;So now I have an /htc directory where I really store my behavior but
a request to /skljfsfcio/border-radius.htc will serve the /htc/border-radius.htc file.
Yay.&lt;br&gt;
&lt;br&gt;
To make this work, you'll need to add an entry to the httpHandlers section in the
web.config&lt;br&gt;
&lt;br&gt;
&amp;lt;add verb="GET" path="*.htc" validate="false" type="HtcAnywhereHandler, HtcAnywhere"
/&amp;gt;&lt;br&gt;
&lt;br&gt;
Then you need to tell IIS to use ASP.NET for .htc files. Go to the web site properties,
Home Directory tab, [configuration...], add an application extension to C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll
for .htc, Limit to: "GET", and turn off verify that it exists.&lt;br&gt;
&lt;br&gt;
The bummer for me was that in my html that border-radius.htc didn't end up working.
Sigh.&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://freachable.net/aggbug.ashx?id=8d67f8b6-b0e2-42c3-b28e-611c342a53f7" /&gt;</description>
      <comments>http://freachable.net/CommentView,guid,8d67f8b6-b0e2-42c3-b28e-611c342a53f7.aspx</comments>
      <category>.NET</category>
      <category>HTML</category>
      <category>SiteFinity</category>
    </item>
  </channel>
</rss>