// --------------------------------------------------------------------
// Common Files
// --------------------------------------------------------------------
/// <summary>
/// Adds the common file path to the filename.
/// </summary>
/// <param name="filename">The filename to qualify with the common path.</param>
/// <returns>The full path of the filename with the common path.</returns>
protected string AddPathToFilename(string filename)
{
return AddPathToFilename(Context, filename);
}
/// <summary>
/// Static version of AddPathToFilename so that classes not deriving from
/// BaseRichControl can still find the common files path.
/// </summary>
/// <param name="context">The context from which to get the configuration.</param>
/// <param name="filename">The filename to qualify with the common path.</param>
/// <returns>The full path of the filename with the common path.</returns>
internal static string AddPathToFilename(HttpContext context, string filename)
{
return FindCommonPath(context) + filename;
}
/// <summary>
/// Finds the path for client files used be server controls.
/// </summary>
/// <param name="context">The context from which to get the configuration.</param>
/// <returns>The path name.</returns>
private static string FindCommonPath(HttpContext context)
{
// Look at the current configuration for the path
if (context != null)
{
NameValueCollection table = (NameValueCollection)context.GetConfig(ConfigName);
if (table != null)
{
string path = (string)table[CommonFilesKey];
if (path != null)
{
return CleanupPath(path);
}
}
}
// Return the default path with version number
Assembly assembly = typeof(BaseRichControl).Assembly;
Version version = assembly.GetName().Version;
return DefaultCommonFilesRoot + version.Major.ToString() + "_" + version.Minor.ToString() + "/";
}
,本来开始的想法是改这个函数,后来发现其实它还有个可配置的路径接口,还是先配置吧!
于是在web.config加入以下节
<configSections>
<section name="MicrosoftWebControls" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</configSections>
<MicrosoftWebControls>
<add key="CommonFiles" value="/web/treepath/"></add>
</MicrosoftWebControls>注意:configSections一定要放在第一个子节最前面.
剪切默认网站的webctrl_client目录到虚拟目录web/treepath/下,运行程序,
