Red Gate forums :: View topic - Cannot decompile CompositeScriptReference GetUrl method
Return to RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
.NET Reflector 7.0 Feedback
.NET Reflector 7.0 Feedback forum

Cannot decompile CompositeScriptReference GetUrl method

Search in .NET Reflector 7.0 Feedback forum
Post new topic   Reply to topic
Jump to:  
Author Message

Joined: 09 Dec 2010
Posts: 13

PostPosted: Tue May 10, 2011 8:21 pm    Post subject: Cannot decompile CompositeScriptReference GetUrl method Reply with quote

Add System.Web.Extensions Version
Go to System.Web.UI.CompositeScriptReference
Try to decompile GetUrl method
Get an error

I reported this several years ago actually, I just want to see the inside of that method already!
Back to top
View user's profile Send private message
Nigel Morse

Joined: 05 Apr 2007
Posts: 164

PostPosted: Wed May 11, 2011 9:23 am    Post subject: Reply with quote

Hi - you should ask this on the help forum at
Back to top
View user's profile Send private message

Joined: 20 Aug 2008
Posts: 45

PostPosted: Wed May 11, 2011 1:15 pm    Post subject: Reply with quote

It's a shame, especially as the .NET 4.0 version works.

The reference source might help:

The file is installed under the oh-so-obvious path of:

The GetUrl method:

[SuppressMessage("Microsoft.Design", "CA1055", Justification = "Consistent with other URL properties in ASP.NET.")]
protected internal override string GetUrl(ScriptManager scriptManager, bool zip) {
    bool isDebuggingEnabled = !scriptManager.DeploymentSectionRetail &&
            ((ScriptMode == ScriptMode.Debug) ||
            (((ScriptMode == ScriptMode.Inherit) || (ScriptMode == ScriptMode.Auto)) &&
    if (!String.IsNullOrEmpty(Path)) {
        string path = Path;
        if (isDebuggingEnabled) {
            path = GetDebugPath(path);
        if (scriptManager.EnableScriptLocalization &&
            (ResourceUICultures != null) && (ResourceUICultures.Length != 0)) {

            CultureInfo currentCulture = CultureInfo.CurrentUICulture;
            string cultureName = null;
            bool found = false;
            while (!currentCulture.Equals(CultureInfo.InvariantCulture)) {
                cultureName = currentCulture.ToString();
                foreach (string uiCulture in ResourceUICultures) {
                    if (String.Equals(cultureName, uiCulture.Trim(), StringComparison.OrdinalIgnoreCase)) {
                        found = true;
                if (found) break;
                currentCulture = currentCulture.Parent;
            if (found) {
                path = (path.Substring(0, path.Length - 2) + cultureName + ".js");

        // ResolveClientUrl is appropriate here because the path is consumed by the page it was declared within
        return ClientUrlResolver.ResolveClientUrl(path);
    List<Pair<Assembly, List<Pair<string, CultureInfo>>>> resources =
        new List<Pair<Assembly, List<Pair<string, CultureInfo>>>>();
    Pair<Assembly, List<Pair<string, CultureInfo>>> resourceList = null;
    foreach (ScriptReference reference in Scripts) {
        bool hasPath = !String.IsNullOrEmpty(reference.Path);
        bool isPathBased = hasPath ||
            (!String.IsNullOrEmpty(scriptManager.ScriptPath) && !reference.IgnoreScriptPath);
        Assembly resourceAssembly = hasPath ?
            null :
            (reference.GetAssembly() ?? AssemblyCache.SystemWebExtensions);
        Assembly cacheAssembly = isPathBased ?
            null :
            (reference.GetAssembly() ?? AssemblyCache.SystemWebExtensions);
        CultureInfo culture = reference.DetermineCulture();

        if ((resourceList == null) || (resourceList.First != cacheAssembly)) {
            resourceList = new Pair<Assembly, List<Pair<string, CultureInfo>>>(
            cacheAssembly, new List<Pair<string, CultureInfo>>());
        string resourceName = null;
        ScriptMode effectiveScriptModeForReference = reference.EffectiveScriptMode;
        bool isDebuggingEnabledForReference =
            (effectiveScriptModeForReference == ScriptMode.Inherit) ?
            isDebuggingEnabled :
            (effectiveScriptModeForReference == ScriptMode.Debug);
        if (isPathBased) {
            if (hasPath) {
                resourceName = reference.GetPath(reference.Path, isDebuggingEnabledForReference);
                if (scriptManager.EnableScriptLocalization && !culture.Equals(CultureInfo.InvariantCulture)) {
                    resourceName = (resourceName.Substring(0, resourceName.Length - 2) +
                        culture.ToString() + ".js");
            else {
                string name = reference.GetResourceName(reference.Name, resourceAssembly, isDebuggingEnabledForReference);
                resourceName = ScriptReference.GetScriptPath(
                    name, resourceAssembly, culture, scriptManager.ScriptPath);

            // ResolveClientUrl not appropriate here because the handler that will serve the response is not
            // in the same directory as the page that is generating the url. Instead, an absolute url is needed
            // as with ResolveUrl(). However, ResolveUrl() would prepend the entire application root name. For
            // example, ~/foo.js would be /TheApplicationRoot/foo.js. If there are many path based scripts the
            // app root would be repeated many times, which for deep apps or long named apps could cause the url
            // to reach the maximum 1024 characters very quickly. So, the path is combined with the control's
            // AppRelativeTemplateSourceDirectory manually, so that ~/foo.js remains ~/foo.js, and foo/bar.js
            // becomes ~/templatesource/foo/bar.js. Absolute paths can remain as is. The ScriptResourceHandler will
            // resolve the ~/ with the app root using VirtualPathUtility.ToAbsolute().
            if (UrlPath.IsRelativeUrl(resourceName) && !UrlPath.IsAppRelativePath(resourceName)) {
                resourceName = UrlPath.Combine(ClientUrlResolver.AppRelativeTemplateSourceDirectory, resourceName);
        else {
            resourceName = reference.GetResourceName(reference.Name, resourceAssembly, isDebuggingEnabledForReference);
        resourceList.Second.Add(new Pair<string, CultureInfo>(resourceName, culture));
    return ScriptResourceHandler.GetScriptResourceUrl(resources, zip, NotifyScriptLoaded);
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Powered by phpBB © 2001, 2005 phpBB Group