Ajax Control Toolkit HtmlEditorExtender插入图像不起作用

时间:2016-04-19 12:19:11

标签: asp.net image insert ajaxcontroltoolkit

当我首先尝试上传图片时,它会显示(已上传),但在2或3秒后它会显示(错误)。

我尝试编辑我的代码和配置文件,但我无法弄清楚错误在哪里。

我在vs 2015社区版中通过nuget下载了ajax控件工具包。

这是我的aspx代码

div class="form-group" >

               <span class="label label-default"><asp:Literal id="AboutUsLabel" runat="server" />Hakkımızda Türkçe</span><br/>
               <%-- <asp:TextBox id="AboutUsText" CssClass="form-control" style="resize:vertical" TextMode="multiline" Columns="50" Rows="20" runat="server" />--%>


                  <asp:TextBox id="AboutUs" CssClass="form-control" style="resize:vertical" TextMode="multiline" Columns="50" Rows="20" runat="server" />

                 <ajaxToolkit:HtmlEditorExtender ID="AboutUsEditor" runat="server"  
    OnImageUploadComplete="AboutUsEditor_ImageUploadComplete"
     TargetControlID="AboutUs" EnableSanitization="false">
    <Toolbar> 
                <ajaxToolkit:Undo />
                <ajaxToolkit:Redo />
                <ajaxToolkit:Bold />
                <ajaxToolkit:Italic />
                <ajaxToolkit:Underline />
                <ajaxToolkit:StrikeThrough />
                <ajaxToolkit:Subscript />
                <ajaxToolkit:Superscript />
                <ajaxToolkit:JustifyLeft />
                <ajaxToolkit:JustifyCenter />
                <ajaxToolkit:JustifyRight />
                <ajaxToolkit:JustifyFull />
                <ajaxToolkit:InsertOrderedList />
                <ajaxToolkit:InsertUnorderedList />
                <ajaxToolkit:CreateLink />
                <ajaxToolkit:UnLink />
                <ajaxToolkit:RemoveFormat />
                <ajaxToolkit:SelectAll />
                <ajaxToolkit:UnSelect />
                <ajaxToolkit:Delete />
                <ajaxToolkit:Cut />
                <ajaxToolkit:Copy />
                <ajaxToolkit:Paste />
                <ajaxToolkit:BackgroundColorSelector />
                <ajaxToolkit:ForeColorSelector />
                <ajaxToolkit:FontNameSelector />
                <ajaxToolkit:FontSizeSelector />
                <ajaxToolkit:Indent />
                <ajaxToolkit:Outdent />
                <ajaxToolkit:InsertHorizontalRule />
                <ajaxToolkit:HorizontalSeparator />
                <ajaxToolkit:InsertImage />

                </Toolbar>
    </ajaxToolkit:HtmlEditorExtender>


             </div>

.cs文件代码

protected void AboutUsEditor_ImageUploadComplete(object sender, AjaxFileUploadEventArgs e)
        {

            string fullPath = "/assets/images/homepage_image/" + e.FileName;

    AboutUsEditor.AjaxFileUpload.SaveAs(MapPath("/assets/images/homepage_image/" + e.FileName));



           e.PostedUrl = Page.ResolveUrl(fullPath);
        }

这个代码在system.web

 <httpHandlers>
          <add verb="*" path="AjaxFileUploadHandler.axd" type="AjaxControlToolkit.AjaxFileUploadHandler, AjaxControlToolkit"/>
        </httpHandlers>

这个代码也在system.webserver

<validation validateIntegratedModeConfiguration="false"/>
    <handlers>
      <add name="AjaxFileUploadHandler" verb="*" path="AjaxFileUploadHandler.axd" type="AjaxControlToolkit.AjaxFileUploadHandler, AjaxControlToolkit"/>
    </handlers>
    <security>
      <requestFiltering>
        <requestLimits maxAllowedContentLength="4294967295"/>
      </requestFiltering>
    </security>

0 个答案:

没有答案