同桌上课用手指进去了好爽_欧美丰满熟妇xxⅹⅹ性大i_成人av天天日天天拍拍_猛男gay帅男gay男男同志_欧美va天堂在线观看_人妻无码av中文系列三里桃花_亚欧免费无码在线观看_久久久精品国产亚洲av水_日韩在线免费看污污污_2021无码专区人妻系列日韩

首頁 優(yōu)化推廣 FCKeditor在ASP.NET中是用偽靜態(tài)時的配置方法

FCKeditor在ASP.NET中是用偽靜態(tài)時的配置方法

來源: | 時間:2013/11/12 20:07:47 |

這兩天接觸了FCKeditor控件,遇到了fckeditor 編輯器無法顯示的問題。一個asp.net企業(yè)站FCKeditor編輯器出現(xiàn)了“Internet Explorer 無法顯示該網(wǎng)頁”,“Internet Explorer 不能鏈接到您請求的網(wǎng)頁。此頁可能暫時不可用”,“已取消到該網(wǎng)頁的導(dǎo)航”等錯誤(根據(jù)游覽器不同,顯示的錯誤頁不同,總之是FCKeditor編輯器無法正常顯示)。同時fckeditor本地運(yùn)行正常,但是到了服務(wù)器上運(yùn)行fckeditor 出問題,打開FCKeditor編輯器屬性中出現(xiàn)res://ieframe.dll/dnserror.htm#或者res://ieframe.dll/dnserrordiagoff.htm#錯誤。以及fckeditor編輯器能夠正常打開而靜態(tài)頁面不能打開等癥狀時,網(wǎng)上都說是設(shè)置路徑的問題,其實不然,應(yīng)該是IIS配置偽靜態(tài)時設(shè)置不當(dāng)引起的。以下是引自sytWeibo的專欄的FCKeditor 2.6.4在ASP.NET中的配置方法”文章中有解決方案,原文地址為http://blog.csdn.net/sytWeibo/archive/2009/07/12/4341641.aspx。如果如我所說的問題,可以直接參考六、常見問題。

FCKeditor 2.6.4在ASP.NET中的配置方法
1、FCKEditor官方下載地址:http://www.fckeditor.net/download。
配置方法如下:
一、在官方網(wǎng)站上下載解壓后目錄結(jié)構(gòu)如下圖所示:
 
二、刪除不必要的文件
從官方下載下來的FCKEditor2.6大小有3.61M(解壓后),其實有很多文件對于只用ASP.NET的來講是不需要的,我們可以刪除不必要的文件:
1.根目錄下除editor目錄、fckconfig.js、fckeditor.js、 fckstyles.xml、 fcktemplates.xml這幾個保留,其余的全部刪除
2.editor\filemanager\connectors目錄中除aspx目錄外全部刪除
3.editor\lang目錄中除en.js、zh.js 、zh-cn.js外全部刪除
4.刪除_samples目錄,當(dāng)然如果你想看示例,就不要刪除這個目錄了。
三、FCKEditor2.6的詳細(xì)設(shè)置
1.fckconfig.js中修改
FCKConfig.ToolbarSets["Default"] = [
['Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript'],
['OrderedList','UnorderedList','-','Outdent','Indent','Blockquote'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'],
['Link','Unlink','Anchor'],
['Image','Flash','Table','Rule','Smiley','SpecialChar','PageBreak'],
'/',
['Style','FontFormat','FontName','FontSize'],
['TextColor','BGColor'],
['FitWindow','ShowBlocks','-','About'] // No comma for the last row.
] ;
//上面一段我去掉了一些不常用的功能,可以根據(jù)實際需要增加。
FCKConfig.DefaultLanguage = 'zh-cn' ;    //原來是en
var _FileBrowserLanguage = 'aspx' ; // asp | aspx | cfm | lasso | perl | php | py 改成aspx
var _QuickUploadLanguage = 'aspx' ; // asp | aspx | cfm | lasso | perl | php | py
2.在Bin中加入DLL文件
注意:通過前面提供的DLL文件下載地址:http://sourceforge.net/project/showfiles.php?group_id=75348&package_id=137125下載FCKeditor.Net_2.6.3.zip壓縮包,解壓后,將FCKeditor.Net_2.6.3\bin\Debug\2.0目錄下的兩個文件拷貝到自己網(wǎng)站的bin文件夾下。
 
3.配置上傳路徑
編輯FCKeditor\editor\filemanager\connectors\aspx\config.aspx 中修改
private bool CheckAuthentication()
{
// WARNING : DO NOT simply return "true". By doing so, you are allowing
// "anyone" to upload and list the files in your server. You must implement
// some kind of session validation here. Even something very simple as...
//
// return ( Session[ "IsAuthorized" ] != null && (bool)Session[ "IsAuthorized" ] == true );
//
// ... where Session[ "IsAuthorized" ] is set to "true" as soon as the
// user logs in your system.
return true; //原來這里是 false;不過還是建議看看上面的警告}
4、WebConfig文件的配置
<appSettings>
    <add key="FCKeditor:BasePath" value="~/fckeditor/"/>
<add key="FCKeditor:UserFilesPath" value="~/Upload/FCKEditor/"/>//我這里設(shè)置在了網(wǎng)站根目錄下的Upload/FCKEditor目錄中,根據(jù)實際情況和個人喜好而定。
</appSettings>
1.我們知道,一個文件夾下面不能存放過多的文件(據(jù)稱Windows下面的目錄下2000為閾值),否則對該目錄的訪問會嚴(yán)重影響I/O性能。而FCKeditor的文件存儲是在單一的一個目錄進(jìn)行的。我對FCKeditor進(jìn)行了擴(kuò)展,可以在Web.config appSettings對存儲目錄的格式自定義:
以今天的日期為例:這樣產(chǎn)生的文件上傳子目錄格式為:2008/10-21/。
<add key="FCKeditor:FolderPattern" value="%y/%m/%d/"/>
2.對上傳圖片進(jìn)行縮放處理
用到FCKeditor圖片上傳功能的場景中,很多是內(nèi)容的發(fā)表。內(nèi)容中往往不需要幾千像素大小的圖片,比如我的項目中,文章區(qū)域最寬也就560像素,所以我做了一個擴(kuò)展,在Web.config appSettings中可以對圖片的最大寬度進(jìn)行自定義:
<add key="FCKeditor:MaxWidthOfUploadedImg" value="560"/>
四、將編輯器用到項目中的簡單實例
首先可以將FCKeditor編輯器空間添加到工具箱中:右鍵【選項卡】-》【選擇項】-》【瀏覽】-》【添加確定】,然后向頁面中拖入FCKeditor控件即可。
下面是一個簡單的fckTest.aspx頁面:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="fckTest.aspx.cs" Inherits="fckTest" %>
<%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head runat="server">
    <title>無標(biāo)題頁</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
     <FCKeditorV2:FCKeditor id="OnLinkEditor" runat ="server" ></FCKeditorV2:FCKeditor>
    </div>
    </form>
</body>
</html>
如何獲取其內(nèi)容呢?讀取OnLinkEditor控件的value屬性值即可。

服務(wù)熱線

153 8323 9821

功能和特性

價格和優(yōu)惠

網(wǎng)站和維護(hù)

推廣和優(yōu)化

微信服務(wù)號