ResourceManager's RenderScripts = File throws 'Ext' is undefined

Page 1 of 3 123 LastLast
  1. #1

    ResourceManager's RenderScripts = File throws 'Ext' is undefined

    Setting ResourceManager's RenderScripts to File throws the following exception:

    'Ext' is undefined
    <ext:ResourceManager runat="server" RenderScripts="File" ScriptMode="Debug" />
  2. #2
    I have had the same problem, but from a different scenario:

    For me, using latest version from SVN causes this same error, regardless of the RenderScripts value. Instead for me it only works if cleanResourceUrl is disabled.

    Further info:


    • Using the version from NuGet works without problems. Could there be some regression between NuGet version and latest?
    • I say latest but noticed this since around 22nd December - only reporting now because of the holidays in the way, sorry!
    • Creating a similar project (empty Web Application with MVC, Web Forms and Web API - all latest versions against .NET 4.5) and then adding reference to the Ext.NET DLLs (including utilities, transformer etc) and applying the same web.config, global.asax etc doesn't work.


    In a bit more detail:

    I've tried to look at many things like global.asax, app start and also trying to get my web.config down to bare minimum and I've not had any luck...

    Here is what I have (a copy/paste from the one created by NuGet I think, possibly with some additional changes after that):

    web.config

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
        <configSections>
            <section name="extnet" type="Ext.Net.GlobalConfig" requirePermission="false" />
        </configSections>
        <appSettings>
            <add key="webpages:Version" value="3.0.0.0" />
            <add key="webpages:Enabled" value="false" />
            <add key="PreserveLoginUrl" value="true" />
            <add key="ClientValidationEnabled" value="true" />
            <add key="UnobtrusiveJavaScriptEnabled" value="true" />
        </appSettings>
        <system.web>
            <compilation debug="true" targetFramework="4.5" />
            <httpRuntime targetFramework="4.5" />
            <pages>
                <namespaces>
                    <add namespace="System.Web.Helpers" />
                    <add namespace="System.Web.Mvc" />
                    <add namespace="System.Web.Mvc.Ajax" />
                    <add namespace="System.Web.Mvc.Html" />
                    <add namespace="System.Web.Routing" />
                    <add namespace="System.Web.WebPages" />
                    <add namespace="Ext.Net" />
                    <add namespace="Ext.Net.MVC" />
                </namespaces>
                <controls>
                    <add assembly="Ext.Net" namespace="Ext.Net" tagPrefix="ext" />
                </controls>
            </pages>
            <httpHandlers>
                <add path="*/ext.axd" verb="*" type="Ext.Net.ResourceHandler" validate="false" />
            </httpHandlers>
            <httpModules>
                <add name="DirectRequestModule" type="Ext.Net.DirectRequestModule, Ext.Net" />
            </httpModules>
        </system.web>
        <system.webServer>
            <validation validateIntegratedModeConfiguration="false" />
            <modules runAllManagedModulesForAllRequests="true">
                <add name="DirectRequestModule" preCondition="managedHandler" type="Ext.Net.DirectRequestModule, Ext.Net" />
            </modules>
            <handlers>
                <add name="DirectRequestHandler" verb="*" path="*/ext.axd" preCondition="integratedMode" type="Ext.Net.ResourceHandler" />
            </handlers>
        </system.webServer>
    
        <extnet theme="Gray" scriptMode="Debug" />
    </configuration>
    global.asax

        public class Global : HttpApplication
        {
            void Application_Start(object sender, EventArgs e)
            {
                // Code that runs on application startup
                AreaRegistration.RegisterAllAreas();
                GlobalConfiguration.Configure(WebApiConfig.Register);
                RouteConfig.RegisterRoutes(RouteTable.Routes);
                ExtNetConfig.RegisterRoutes(RouteTable.Routes);
            }
    
            protected void Application_AuthenticateRequest(object sender, EventArgs e)
            {
                // Skip authenticating all ext.axd embedded resources (.js, .css, images)
                if (HttpContext.Current.Request.FilePath.EndsWith("/ext.axd"))
                {
                    HttpContext.Current.SkipAuthorization = true;
                }
            }
        }
    ExtNetConfig (note it is called from global.asax unlike the NuGet version which uses WebActivator)

        public static class ExtNetConfig 
        {
            public static void RegisterRoutes(RouteCollection routes)
            {
                // Ignore all ext.axd embedded resource paths
                routes.IgnoreRoute("{extnet-root}/{extnet-file}/ext.axd"); // NuGet uses this
                routes.IgnoreRoute("{exclude}/{extnet}/ext.axd"); // some examples use this... Hence I have added both for now...
    
                // Add http://example.com/extnet/ Route
                routes.MapRoute(
                    "ExtNet", // Route name
                    "extnet/{action}/{id}", // URL with parameters
                    new { controller = "ExtNet", action = "Index", id = UrlParameter.Optional } // Parameter defaults
                );
            }
        }
    With the above, I use the default Ext.NET.default.aspx that comes with NuGet and it fails with this error in the browser console:

    "NetworkError: 404 Not Found - http://localhost:8124/extjs/ext-all-js/ext.axd?v=21110"
    "NetworkError: 404 Not Found - http://localhost:8124/extnet/extnet-all-js/ext.axd?v=21110"
    ReferenceError: Ext is not defined
    So Ext is not defined because the ext.axd resource is returning not found.

    Note, these settings/code changes noted above were duplicated from the NuGet version which works. I have tinkered with them trying to get them to work so maybe I have missed something. The main differences are that
    - Global.asax I invoked the ExtNetConfig manually
    - Web.config I don't have/need a runtime section

    In addition, the above code DOES work, if the following change is made:

    Disable cleanResourceUrl in web.config:

    <extnet scriptMode="Debug" cleanResourceUrl="false" />
    So it feels like I have set it up right (I can't spot anything I have missed).

    Is this a regression between the NuGet version and SVN version? (If it helps, I had this problem around 22nd December as well - but after a few days holiday only now going back to it.)
    Last edited by geoffrey.mcgill; Jan 23, 2015 at 1:09 PM.
  3. #3
    Anup, i also tried to figure out what is going on, but unfortunately with no success.

    Thank you for sharing so valuable information regarding this issue. It's gonna be useful for addressing the issue.

    I will keep you posted about any update.
  4. #4
    @RaphaelSaldanha

    confirmed in IE. FF works ok.
  5. #5
    I confirm that this issue is still reproducible on version 3.1.0.
  6. #6
    Hello everybody,

    I think here are two different issues discussed in this thread.

    Raphael, RenderScripts="File" assumes that you have manually put the required Ext.NET JavaScript files into a folder inside your application. Please clarify have you done that?

    Anup, I were able to reproduce the issue and a solution is something interesting. This recent post (that stuck in my mind) regarding a very different issue helped me to find a solution quickly.
    http://forums.ext.net/showthread.php...l=1#post235521

    Please try to remove this from the <system.web> section in Web.config.
    <httpHandlers>
        <add path="*/ext.axd" verb="*" type="Ext.Net.ResourceHandler" validate="false"/>
    </httpHandlers>
    It starts working for me if remove.

    It looks that having HTTP handlers (and, probably, modules) defined in both the sections - <system.web> and <system.webServer> - might cause very frustrating and hard-to-find-and-solve issues. It is lucky that I had that post (in the other thread) before working on the issue in this thread.

    Here is a very relevant article written by Dave Donaldson.
    http://arcware.net/use-a-single-web-...-iis6-and-iis7

    As a summary, he tells that HTTP handlers and modules must not be defined in both the sections - <system.web> and <system.webServer> and you should have two different Web.configs for IIS6 and IIS7. Though, there is a trick to have the only Web.config. The trick is to set up this:
    <system.webServer>
        <validation validateIntegratedModeConfiguration="false" />
    </system.webServer>
    As far as I can see we have such an option in our Web.configs, but issues still happens. So, probably, it is best to avoid having HTTP handlers and modules in both the sections.

    I am going to write a follow-up comment for the Dave's article. Maybe, he will shed some light on this issue or, maybe, would like to investigate if he doesn't have that light to shed:)

    Also a small clarification why it works with cleanResourceUrl="false". In this case, the default WebResource.axd is used and, apparently, it handles the situation.
  7. #7
    Daniil,

    Thanks. Removing that handler from system.web did the trick.

    The thing I don't get is that this was not a necessary step for me if I installed from NuGet (and had the exact same web.config!) When I first posted the problem, the version from SVN and from NuGet were not that far apart, either.

    Also, my production project which I am migrating up to 3.x also doesn't have this problem and it has this handler in the system.web section.

    Still, good to know. Thanks for the additional details and links.
  8. #8
    Daniil, I spoke a bit too soon.

    While certainly removing that handler helped, I now notice that whether I use cleanResourceUrl="false" or "true" makes no difference: the script links produced are always pointing to webresource.axd.

    Other than much longer URLs is there any important difference?

    I remember a long time ago there was something about potentially the webresource.axd one resulting in multiple instance of the same code being loaded more than once, whereas somehow the clean resource URLs didn't do that, but I can't find that thread any more...
  9. #9
    The thing I don't get is that this was not a necessary step for me if I installed from NuGet (and had the exact same web.config!) When I first posted the problem, the version from SVN and from NuGet were not that far apart, either.
    Hard to say what is causing the difference.

    Also, my production project which I am migrating up to 3.x also doesn't have this problem and it has this handler in the system.web section.
    Maybe, it is something with IIS Express? Or some other differences between exact IIS instances and its settings.

    While certainly removing that handler helped, I now notice that whether I use cleanResourceUrl="false" or "true" makes no difference: the script links produced are always pointing to webresource.axd.
    That means that Ext.NET resource handler is probably not attached somehow.

    Other than much longer URLs is there any important difference?
    Our resource handler provides auto caching and gzipping, at least. You could review the code to investigate in details.
    Ext.Net\Core\ResourceHandler.cs
  10. #10
    It looks like, at least, that we should remove or comment out the definitions of HTTP handlers and modules for IIS 6 in our Web.configs. Created an Issue:
    https://github.com/extnet/Ext.NET/issues/650
Page 1 of 3 123 LastLast

Similar Threads

  1. Replies: 0
    Last Post: Dec 10, 2013, 3:55 PM
  2. Replies: 1
    Last Post: Nov 12, 2012, 2:29 PM
  3. [CLOSED] How to include a js/css file with ResourceManager?
    By vadym.f in forum 1.x Legacy Premium Help
    Replies: 11
    Last Post: Jun 20, 2012, 9:02 PM
  4. [CLOSED] renderScripts="File" renderStyles="File" adding extra '/'
    By SouthDeveloper in forum 1.x Legacy Premium Help
    Replies: 8
    Last Post: Nov 24, 2011, 12:23 PM
  5. [CLOSED] [1.0] ResourceManager RenderStyles / RenderScripts
    By danielg in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Mar 10, 2011, 10:45 AM

Posting Permissions