ScriptManager (私の MasterPage に含まれる) およびScriptManagerProxies (コンテンツ ページ)。
コードで簡単に ScriptManager にアクセスし、その Scripts コレクションを繰り返し処理して、宣言的に設定したスクリプト パスを取得し、"?[lastmodifiedtimestamp]" を追加して新しいパスを "設定" できます。
問題は、存在する可能性のある ScriptManagerProxies にアクセスする方法がわからないことです。
デバッグ時に、非パブリック メンバー (._proxies) にプロキシが表示されます。ドキュメントに目を通しましたが、このコレクションに実際にパブリックにアクセスできる場所がわかりません。
私は何か不足していますか?
コンテンツ ページの Page_PreRenderComplete イベントの基本クラスに次のコードがあります。
ScriptManager sm = ScriptManager.GetCurrent((Page)this);
if(sm != null)
{
foreach (ScriptReference sr in sm.Scripts)
{
string fullpath = Server.MapPath(sr.Path);
sr.PathWithVersion(fullpath); //extension method that sets "new" script path
}
}
上記のコードは、MasterPage で定義した 1 つのスクリプトを提供しますが、コンテンツ ページの ScriptManagerProxy で定義した他の 2 つのスクリプトは提供しません。