I have a situation where I'd like to add a "last modified" timestamp to the paths of my js files (ex. "custom.js?2009082020091417") that are referenced in my ScriptManager (contained in my MasterPage) and in any ScriptManagerProxies (content pages).
I can easily get access to the ScriptManager in code and then iterate through it's Scripts collection to get the Script paths that I've set declaratively and then "set" a new path with the tacked on "?[lastmodifiedtimestamp]".
The problem is, I can't figure out how to get to any ScriptManagerProxies that may exist.
When debugging, I can see the proxies in the non-public members (._proxies). I've looked through the documentation and can't see where you can actually publicly access this collection.
Am I'm missing something?
I have the following code in the base class of my content page's Page_PreRenderComplete event:
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
}
}
The above code gives me the one script I have defined in my MasterPage, but not the two other scripts I have defined in the ScriptManagerProxy of my content page.