3

I have integrated freetext box with website.

It's working well for all browser except recently release IE 11.

It throws error "Object reference not set to an instance of an object."

Following is the error stack trace:

 at FreeTextBoxControls.FreeTextBox.RenderTabs(HtmlTextWriter writer) at
 FreeTextBoxControls.FreeTextBox.RenderRichEditor(HtmlTextWriter writer) at
 FreeTextBoxControls.FreeTextBox.Render(HtmlTextWriter writer) at
 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) at
 System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) at
 System.Web.UI.Control.RenderControl(HtmlTextWriter writer) at
 ASP.myaspxpage.__Render__control4(HtmlTextWriter __w, Control parameterContainer) in
 pathtomyaspxpage:line 505 at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer,
 ICollection children) at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) at
 System.Web.UI.Control.Render(HtmlTextWriter writer) at
 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) at
 System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) at
 System.Web.UI.Control.RenderControl(HtmlTextWriter writer) at
 System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) at
 System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) at
 System.Web.UI.UpdatePanel.RenderChildren(HtmlTextWriter writer) at
 System.Web.UI.UpdatePanel.Render(HtmlTextWriter writer) at
 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) at
 System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) at
 System.Web.UI.Control.RenderControl(HtmlTextWriter writer) at
 System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) at
 System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) at
 System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) at
 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) at
 System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) at
 System.Web.UI.Control.RenderControl(HtmlTextWriter writer) at
 System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) at
 System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) at
 System.Web.UI.Control.Render(HtmlTextWriter writer) at
 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) at
 System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) at
 System.Web.UI.Control.RenderControl(HtmlTextWriter writer) at
 mymasterpage.__Renderform1(HtmlTextWriter __w, Control parameterContainer) in
 pathtomymasterpage:line 87 at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriterwriter, 
 ICollection children) at System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter
 writer) at System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) at
 System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter output) at
 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) at
 System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) at
 System.Web.UI.HtmlControls.HtmlForm.RenderControl(HtmlTextWriter writer) at
 System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) at
 System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) at
 System.Web.UI.Control.Render(HtmlTextWriter writer) at
 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) at
 System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) at
 System.Web.UI.Control.RenderControl(HtmlTextWriter writer) at
 System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) at
 System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) at
 System.Web.UI.Page.Render(HtmlTextWriter writer) at
 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) at
 System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) at
 System.Web.UI.Control.RenderControl(HtmlTextWriter writer) at
 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean
 includeStagesAfterAsyncPoint)

Any help would be appreciated.

Thanks

Garrison Neely
  • 3,238
  • 3
  • 27
  • 39
MaheshValu
  • 101
  • 2
  • 10

5 Answers5

4

Confirmed Solution: Fix Object reference not set to an instance of an object OR freetext box rendered as textarea problems.

  1. Download the source code from http://freetextbox.com/ (source is now available to all)
  2. Open the project file relevant to your environment (e.g. FTB3-v2010-NET-3-5)
  3. Edit file /Support/BrowserInfo.cs
  4. Find this line browserInfo.isIE = (userAgent.IndexOf("msie") > -1) and change it to browserInfo.isIE = (userAgent.IndexOf("msie") > -1) || (userAgent.IndexOf("trident") > -1);
  5. Remove assembly signing (or use your own) in AssemblyInfo.cs by removing line [assembly: AssemblyKeyFile("..\\..\\FreeTextBox.snk")] and optionally change the version number as per you needs.
  6. Hit compile and use the generated DLL (in the ../build folder)

I was able to do this change to enable new IE support. You can make more changes to this file for other browser issues too.

Vaibhav Garg
  • 3,630
  • 3
  • 33
  • 55
  • 1
    I was experiencing the same issue with IE11. Fixing the source in this manner worked great. – Troy Harris Mar 02 '16 at 20:39
  • 1
    I too had this issue and can confirm this worked perfectly. Updating the source and recompiling took just a few minutes, no errors, easy DLL swap, no more IE 11 issues. – Demig0d Oct 25 '16 at 18:25
2

I ran into the same issue. FTB is not longer under development and the removal of the MSIE token from IE 11's user agent broke FTB's functionality. Since FTB is reading the user agent directly this occurs even on servers patched with the IE 11 .Net fix or .Net 4.5.

To resolve this situation until we can find a viable alternative for the FTB control I created a rewrite rule to detect IE 11 and rewrite the user agent. Don't forget to add the server variable "HTTP_USER_AGENT".

<rewrite>
<rules>
<rule name="Change IE 11 User Agent to IE 10" enabled="true">
  <match url="(.*)" />
  <action type="None" />
  <conditions>
    <add input="{HTTP_USER_AGENT}" pattern=".trident\/[789]" />
  </conditions>
  <serverVariables>
    <set name="HTTP_USER_AGENT" value="Mozilla/5.0 (compatible; MSIE 11.0; Windows NT 6.2; Trident/7.0)" />
  </serverVariables>
 </rule>
 </rules>
</rewrite>
Carl Weiss
  • 39
  • 3
  • On our ASP.NET 2 application (4-5 years old) FTB was throwing the same error, but this rewrite rule worked perfectly. – ahwm Jun 24 '14 at 16:33
  • Tried this, but unfortunately this doesn't work in IIS 6, IIS 6 has no rewrite mechanism. – live-love Dec 08 '14 at 15:13
0

We also had a similar issue at the company I work for. In our case a NullReferenceException was thrown by the method SetToolbarDropDownListLanguage(ToolbarDropDownList toolbarDropDownList).

Hopefully we had bought the code with the component so we manage to retrieve the source of error.

The component is sniffing the browser capabilities based on its User Agent (which is considered as a bad idea today but was the standard approach when the component has been developed).

But default IE11 User Agent is really different from previous version:

Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko

The default IE10 UA:

Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)

See that missing MSIE in the UA ? More or less, based on this string, the FreeTextBox component set a IsRichCapable property on a BrowserInfo object.

If the IsRichCapable is set to false, some objects are not well instantiate and then you start to see some null reference exceptions.

In our case, as we have the source code we managed to modify the IsRichCapable property to be always true because we know that our website won't be accessed with "exotic" or "older" browsers:

public bool IsRichCapable
{
    get { return true; }
}

If you can't change the code and if you can't replace the FreeTextBox component, I assume that your best solution is to try to detect IE11 User-Agent and rewrite it, but i don't know if it is possible.

Thomas Ledan
  • 118
  • 11
-1

We had the same issue for our web sites at the company I work for. As Garrison Neely mentioned, their web site says it only supports up to IE 9. It did work on IE 10. I don't think the company exist anymore.

I ended up replacing the control with the HTML Editor from the Ajax Control Toolkit. The HTML Editor was easy to setup and it looks a lot nicer in my opinion. Microsoft also supports these controls and they have a lot of video tutorials here: http://www.asp.net/web-forms/videos/ajax-control-toolkit.

Sorry I can help you with your issue with the FreeTextBox control but I recommend you pick a different HTML editor.

bkanator
  • 11
  • 2
  • Tried this control, it works, but the HTML Editor looks a little different, and the setup was not so easy. We have master pages and needed to replace all the ScriptManager code and its proxies for this. – live-love Dec 08 '14 at 15:15
-1

I was able to rewrite the url to include msie to user agent. but still it is not working from asp.net 2.0 free text box. I have to use ie 8 compatible mode. All other controls work if I set the x-ua. But freetext box alone is rendered as text area. I do not have the license for source code

SMP
  • 1