我已将freetext框与网站集成。
除了最近发布的IE 11之外,它适用于所有浏览器。
它抛出错误"对象引用未设置为对象的实例。"
以下是错误堆栈跟踪:
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)
任何帮助都将不胜感激。
由于
答案 0 :(得分:3)
已确认的解决方案:修复对象引用未设置为对象的实例或自由文本框呈现为textarea 问题。
/Support/BrowserInfo.cs
browserInfo.isIE = (userAgent.IndexOf("msie") > -1)
并将其更改为browserInfo.isIE = (userAgent.IndexOf("msie") > -1) || (userAgent.IndexOf("trident") > -1);
AssemblyInfo.cs
行中的程序集签名(或使用您自己的程序集),删除行[assembly: AssemblyKeyFile("..\\..\\FreeTextBox.snk")]
,并根据需要随时更改版本号。../build
文件夹中)我能够进行此更改以启用新的IE支持。您也可以针对其他浏览器问题对此文件进行更多更改。
答案 1 :(得分:2)
我遇到了同样的问题。 FTB不再处于开发阶段,从IE 11的用户代理中删除MSIE令牌打破了FTB的功能。由于FTB直接读取用户代理,甚至在使用IE 11 .Net fix或.Net 4.5修补的服务器上也会出现这种情况。
要解决这种情况,直到我们找到FTB控件的可行替代方法,我创建了一个重写规则来检测IE 11并重写用户代理。不要忘记添加服务器变量“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>
答案 2 :(得分:0)
我们在我工作的公司也有类似的问题。
在我们的例子中,方法SetToolbarDropDownListLanguage(ToolbarDropDownList toolbarDropDownList)
抛出了NullReferenceException。
希望我们已经使用组件购买了代码,因此我们设法检索错误源。
该组件基于其用户代理嗅探浏览器功能(今天这被认为是一个坏主意,但是在开发组件时是标准方法)。
但默认的IE11用户代理与以前的版本完全不同:
Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko
默认IE10 UA:
Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)
在UA中看到缺少MSIE
?或多或少,基于此字符串,FreeTextBox组件在IsRichCapable
对象上设置BrowserInfo
属性。
如果IsRichCapable
设置为false,则某些对象不能很好地实例化,然后您开始看到一些空引用异常。
在我们的案例中,由于我们拥有源代码,因此我们设法将IsRichCapable
属性修改为始终为真,因为我们知道我们的网站无法通过&#34;异国情调&#34;或者&#34;年长的&#34;浏览器:
public bool IsRichCapable
{
get { return true; }
}
如果您无法更改代码,如果您无法替换FreeTextBox组件,我认为您最好的解决方案是尝试检测IE11 User-Agent并重写它,但我不会&#39 ;知道是否有可能。
答案 3 :(得分:-1)
我们在我工作的公司网站上遇到了同样的问题。正如Garrison Neely所说,他们的网站说它只支持IE 9.它确实在IE 10上运行。我认为公司不再存在。
我最终用Ajax Control Toolkit中的HTML编辑器替换了控件。 HTML编辑器很容易设置,在我看来它看起来更好。 Microsoft也支持这些控件,他们在这里有很多视频教程:http://www.asp.net/web-forms/videos/ajax-control-toolkit。
很抱歉,我可以帮助您解决FreeTextBox控件的问题,但我建议您选择其他HTML编辑器。
答案 4 :(得分:-1)
我能够重写url以将msie包含到用户代理中。但它仍然无法使用asp.net 2.0免费文本框。我必须使用ie 8兼容模式。如果我设置x-ua,所有其他控件都有效。但单独的自由文本框被渲染为文本区域。我没有源代码许可证