Ext is not defined

  1. #1

    Ext is not defined

    After installing v2 beta I get these errors:

    • "http://localhost/DemoExNet/extnet/extnet-all-debug-js/ext.axd?v=39235Failed to load resource: the server responded with a status of 404 (Not Found)"
    • "http://localhost/DemoExNet/extjs/ext-all-debug-js/ext.axd?v=39235Failed to load resource: the server responded with a status of 404 (Not Found)" in the javascipt console.



    My web.config seems to be configured correctly (as in the readme):

    <?xml version="1.0" encoding="utf-8"?>
    <!--
      For more information on how to configure your ASP.NET application, please visit
      http://go.microsoft.com/fwlink/?LinkId=152368
      -->
    <configuration>
      <configSections>
        <section name="extnet" type="Ext.Net.GlobalConfig" requirePermission="false" />
      </configSections>
      <connectionStrings>
        <add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient" />
      </connectionStrings>
      <appSettings>
        <add key="webpages:Version" value="1.0.0.0" />
        <add key="ClientValidationEnabled" value="true" />
        <add key="UnobtrusiveJavaScriptEnabled" value="true" />
      </appSettings>
      <system.web>
        <compilation debug="true" targetFramework="4.0">
          <assemblies>
            <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
            <add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
            <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
            <add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
            <add assembly="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
          </assemblies>
        </compilation>
        <authentication mode="Forms">
          <forms loginUrl="~/Account/LogOn" timeout="2880" />
        </authentication>
        <membership>
          <providers>
            <clear />
            <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" />
          </providers>
        </membership>
        <profile>
          <providers>
            <clear />
            <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/" />
          </providers>
        </profile>
        <roleManager enabled="false">
          <providers>
            <clear />
            <add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/" />
            <add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/" />
          </providers>
        </roleManager>
        <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" />
          </namespaces>
        </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>
      <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <dependentAssembly>
            <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
            <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="3.0.0.0" />
            <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" />
            <bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.0.8.0" />
          </dependentAssembly>
        </assemblyBinding>
      </runtime>
      <extnet theme="Default" renderScripts="Embedded" scriptMode="Debug" />
    </configuration>

    The code I am trying is simply:

    <%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
        Home Page
    </asp:Content>
    
    <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
        <h2>
            <%: ViewBag.Message %></h2>
        <ext:ResourceManager ID="ResourceManager1" runat="server" />
        <ext:ComboBox ID="ComboBox1"
                runat="server" 
                Editable="false"         
                EmptyText="Select a state...">
                <Items>
                    <ext:ListItem Text="Alabama" Value="AL" />
                    <ext:ListItem Text="Alaska" Value="AK" />
                </Items>
            </ext:ComboBox>
    </asp:Content>

    When I've installed the package by nuget it gave me no errors.

    Where's the error???


    Thanks
    Last edited by cristianscotti; Mar 30, 2012 at 5:55 AM.
  2. #2
    I see that you use Forms authentification
    Try to add this code to Global.asax
    protected void Application_AuthenticateRequest(object sender, System.EventArgs e)
            {
                string url = HttpContext.Current.Request.FilePath;
    
    
                if (url.EndsWith("ext.axd"))
                {
                    HttpContext.Current.SkipAuthorization = true;
                }
            }
    Or try to set CleanResourceUrl=false for ResourceManager in login page
  3. #3

    just attempted

    I've just attempted that solution, but the result is the same. The page does not require authentication. I also tried to switch off the authentication. Note that if I use Ext.net within a webforms project all works perfect. Only if i use MVC I have that trouble. I am using MVC3 on vs 2010 Premium SP1 with all updates installed. I tried both Razor and aspx engines. I also tried to recreate clean MVC projects with the same result.
  4. #4
    If you use MVC then you have to skip routing for ext.axd requests
    Add this code to Global.asax
    public static void RegisterRoutes(RouteCollection routes)
            {
                routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
                routes.IgnoreRoute("{exclude}/{extnet}/ext.axd");
    
    
                routes.MapRoute(
                    "Default", // Route name
                    "{controller}/{action}/{id}", // URL with parameters
                    new { controller = "Examples", action = "Index", id = UrlParameter.Optional } // Parameter defaults
                );
    
    
            }
    
    
            protected void Application_Start()
            {
                ....
                RegisterRoutes(RouteTable.Routes);
            }
  5. #5
    That was the problem. Thanks Vladimir. Have a nice day

    Regards

    Cristian
    Last edited by geoffrey.mcgill; Aug 13, 2015 at 5:13 AM.

Similar Threads

  1. Ext is not defined !
    By bmagana in forum 1.x Help
    Replies: 1
    Last Post: Jun 22, 2011, 2:50 PM
  2. EXT is not defined! please help
    By wasseem78 in forum 1.x Help
    Replies: 2
    Last Post: May 16, 2011, 7:26 AM
  3. Ext is not defined
    By Yannis in forum 1.x Help
    Replies: 4
    Last Post: Mar 28, 2011, 3:06 PM
  4. Ext is not defined...
    By flaviodamaia in forum 1.x Help
    Replies: 3
    Last Post: Mar 11, 2010, 1:54 PM
  5. " " is not defined
    By vishnukamatam in forum 1.x Help
    Replies: 3
    Last Post: Mar 05, 2010, 1:42 PM

Posting Permissions