Tuesday, November 22, 2005

FreeTextBox 3.1.1 without aspnet_client directory

I have already blogged about how to get FreeTextBox 3.0.x  working without an aspnet_client subfolder with its hundreds of files.  FreeTextBox has seen several revisions since that post, and amazingly they still have not got it right.

I just tried FreeTextBox 3.1.1.  They have it much closer.  Now I don't have to decompile their assembly to fix their obvious bugs to get it working.  But their README file that comes with the assembly and their online installation instructions wiki still claims that with ASP.NET 2.0 you don't have to add httpHandlers to your Web.config file or the SupportFolder="~/FtbWebResource.axd" attribute to your web page.  And it's still wrong, at least for one, maybe both of those points, depending on your ASP.NET version.

So here are the instructions (much simpler than the old ones for 3.0.x) to get your FreeTextBox 3.1.1 working without aspnet_client in ASP.NET 2.0:

  1. Add FreeTextBox.dll to your web application's Bin directory.
  2. If you are using any version of ASP.NET 2.0 prior to the RTM version, add this xml to your Web.config file between your tags.  I experimented and found that even Microsoft's RC version required this next segment, although its RTM version does not.
    <system.web>
     <!-- rest of your Web.config file content -->
     <httpHandlers>
      <add verb="GET" path="FtbWebResource.axd" type="FreeTextBoxControls.AssemblyResourceHandler, FreeTextBox"/>
     </httpHandlers>
    </system.web>
  3. Add this tag to the top of your web page:
    <%@ Register TagPrefix="FTB" Namespace="FreeTextBoxControls" Assembly="FreeTextBox" %>
  4. And this tag where you want your FreeTextBox to appear on your web page.  The SupportFolder attribute is not mentioned as required on the FreeTextBox's installation wiki or in its readme file, but it's still required.
    <FTB:FreeTextBox ID="FreeTextBox1" SupportFolder="~/FtbWebResource.axd" runat="Server"/>

See?  Much simpler than FTB 3.0.x, but still, the FTB claims you can leave out step 2, and part of step 4 (the SupportFolder attribute).  Beware. 

And remember, if you want to test my instructions and remove the SupportFolder attribute, that you must re-save Web.config with each change of your tag to force a web app restart, because FTB caches settings and doesn't notice your changes right away, so you'll be getting some bad tests unless you restart your web app.  Note that this provision only appears to be true in pre-RTM versions of ASP.NET, so this may have been a Microsoft issue rather than a FTB one.

2 comments:

  1. I was pleased to find your blog on how to implement this control - however, I cannot place the cursor into the FTB textarea to enter text, it just doesn't activate, I can use the drop-downs for Font etc. but I need to be able to enter text. I tried on a clean page and it works well, but the page that I need it to work on is a user control, how can I get this to work?

    Many thanks

    ReplyDelete
  2. Just found your blog on FreeTextBox implementation with asp.net. I was wonder since it is now at 3.2.2 version are these fixes still viable?

    ReplyDelete