首先获取host -> http://stackoverflow.com/questions/689678/request-url-host-and-applica...

  public static string GetSiteRoot()
    {
        string port = System.Web.HttpContext.Current.Request.ServerVariables["SERVER_PORT"];
        if (port == null || port == "80" || port == "443")
            port = "";
        else
            port = ":" + port;

        string protocol = System.Web.HttpContext.Current.Request.ServerVariables["SERVER_PORT_SECURE"];
        if (protocol == null || protocol == "0")
            protocol = "http://";
        else
            protocol = "https://";

        string sOut = protocol + System.Web.HttpContext.Current.Request.ServerVariables["SERVER_NAME"] + port + System.Web.HttpContext.Current.Request.ApplicationPath;

        if (sOut.EndsWith("/"))
        {
            sOut = sOut.Substring(0, sOut.Length - 1);
        }

        return sOut;
    }

之后在 ckfinder/config.ascx 配置路径

// The base URL used to reach files in CKFinder through the browser.
BaseUrl = GetSiteRoot() + "/ckfinder/userfiles/";

// The phisical directory in the server where the file will end up. If
// blank, CKFinder attempts to resolve BaseUrl.
BaseDir = Request.PhysicalApplicationPath + @"ckfinder\userfiles\";

Chobits
7.4k 声望171 粉丝

保卫骡博 Chobits#3780