VS2010 + ASP.NET MVC + Ext.NET

  1. #1

    VS2010 + ASP.NET MVC + Ext.NET

    Hi,

    We're evaluating Ext.NET before purchase but I'm having real trouble getting Ext.NET to work correctly in an ASP.NET MVC project. Having read the homepage, it seemed to indicate quite clearly this would work with MVC, unless I've misinterpreted what it meant?

    My error is the "The web.config file for this project is missing the required DirectRequestModule." message. Following the README.TXT file, I added the web.config entries as shown at the end of this post. Still I get the error. I have a standard ASP.NET MVC solution, created using the template that ships with VS 2010 (with a pre-defined HomeController etc). The only code I've added is to put a ResourceManager and ExtWindow conrol into the Index.aspx file of the Home views folder.

    Is there something I'm doing incorrectly?

    Cheers,
    Peter

    <?xml version="1.0"?>
    
    <configuration>
        <configSections>
            <section name="extnet" type="Ext.Net.GlobalConfig" requirePermission="false" />
        </configSections>
    
        <extnet />
        <system.web>
            <httpHandlers>
                <add path="*" verb="*" type="System.Web.HttpNotFoundHandler"/>
                <add path="*/ext.axd" verb="*" type="Ext.Net.ResourceHandler" validate="false" />
            </httpHandlers>
            <httpModules>
                <add name="DirectRequestModule" type="Ext.Net.DirectRequestModule, Ext.Net" />
            </httpModules>
    
            <!--
            Enabling request validation in view pages would cause validation to occur
            after the input has already been processed by the controller. By default
            MVC performs request validation before a controller processes the input.
            To change this behavior apply the ValidateInputAttribute to a
            controller or action.
        -->
            <pages
                validateRequest="false"
                pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
                pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
                userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
                <controls>
                    <add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />
                </controls>
            </pages>
        </system.web>
    
        <system.webServer>
            <validation validateIntegratedModeConfiguration="false" />
            <modules>
                <add
                    name="DirectRequestModule"
                    preCondition="managedHandler"
                    type="Ext.Net.DirectRequestModule, Ext.Net"
    				/>
            </modules>
            <handlers>
                <remove name="BlockViewHandler"/>
                <add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />
                <add
                            name="DirectRequestHandler"
                            verb="*"
                            path="*/ext.axd"
                            preCondition="integratedMode"
                            type="Ext.Net.ResourceHandler"
    				/>
            </handlers>
        </system.webServer>
    </configuration>
  2. #2
    Hi,

    Can you create test project, zip and post it? I will check it. Please do not attach any assemblies
  3. #3
    Couldnt attach the file to the site (error about the size limit for .ZIP file being exceeded). I've uploaded it to my iDisk, sans the DLLs:

    https://files.me.com/peter.campbell/f8s8tg (273Kb)

    Thanks.
  4. #4
    Hi,

    1. Your web.config doesn't contain modules amd handler sections. Here is modified config
    <?xml version="1.0"?>
    <!--
      For more information on how to configure your ASP.NET application, please visit
      http://go.microsoft.com/fwlink/?LinkId=152368
      -->
    <configuration>
    	<connectionStrings>
    		<add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient"/>
    	</connectionStrings>
    	<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.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    				<add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    				<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/></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.Mvc"/>
    				<add namespace="System.Web.Mvc.Ajax"/>
    				<add namespace="System.Web.Mvc.Html"/>
    				<add namespace="System.Web.Routing"/>
    			</namespaces>
    		</pages>
            <httpHandlers>
                <remove path="*.asmx" verb="*"/>
                <add path="*.asmx" verb="*" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
                <add path="*_AppService.axd" verb="*" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
                <add path="ScriptResource.axd" verb="GET,HEAD" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
                <add path="*.mvc" verb="*" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
                <add path="*/ext.axd" verb="*" type="Ext.Net.ResourceHandler" validate="false"/>
                <add path="WebResource.axd" verb="GET" type="System.Web.Handlers.AssemblyResourceLoader" validate="true" />
                <add path="ChartImg.axd" verb="GET,HEAD" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false" />
            </httpHandlers>
            <httpModules>
                <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
                <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
                <add name="DirectRequestModule" type="Ext.Net.DirectRequestModule, Ext.Net"/>
            </httpModules>
    	</system.web>
    	<system.webServer>
    		<validation validateIntegratedModeConfiguration="false"/>
            <modules runAllManagedModulesForAllRequests="true">
                <remove name="ScriptModule" />
                <remove name="UrlRoutingModule" />
                <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
                <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
                <add name="DirectRequestModule" type="Ext.Net.DirectRequestModule, Ext.Net" />
            </modules>
            <handlers>
                <remove name="WebServiceHandlerFactory-Integrated" />
                <remove name="ScriptHandlerFactory" />
                <remove name="ScriptHandlerFactoryAppServices" />
                <remove name="ScriptResource" />
                <remove name="MvcHttpHandler" />
                <remove name="UrlRoutingHandler" />
                <add name="ExtNetHandler" path="*/ext.axd" verb="*" type="Ext.Net.ResourceHandler" />
                <add name="WebResourceHandler" path="WebResource.axd" verb="GET" type="System.Web.Handlers.AssemblyResourceLoader" />
                <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
                <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
                <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=34.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
                <add name="MvcHttpHandler" preCondition="integratedMode" verb="*" path="*.mvc" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
                <add name="UrlRoutingHandler" preCondition="integratedMode" verb="*" path="UrlRouting.axd" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
                <add name="ChartImageHandler" preCondition="integratedMode" verb="GET,HEAD" path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
            </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" newVersion="2.0.0.0"/>
    			</dependentAssembly>
    		</assemblyBinding>
    	</runtime>
    </configuration>

    2. You have to add the following code to Global.asax.cs RegisterRoutes method
    routes.IgnoreRoute("{exclude}/{extnet}/ext.axd");
  5. #5
    Thanks, we got there in the end. It was to do with the position of

     <httpModules>
          <add name="DirectRequestModule" type="Ext.Net.DirectRequestModule, Ext.Net" />
        </httpModules>
    .. in the Web.Config file.

    Cheers.

Similar Threads

  1. How to use Ext.NET Beta with VS2010 .NET3.5
    By Mr.Techno in forum 2.x Help
    Replies: 0
    Last Post: May 29, 2012, 8:56 AM
  2. Go To Definition in VS2010
    By tallman in forum 1.x Help
    Replies: 0
    Last Post: Dec 28, 2011, 2:28 PM
  3. VS2010 and ExtJS Intellisense
    By Wellington Caetano in forum 1.x Help
    Replies: 2
    Last Post: Jun 07, 2011, 1:37 PM
  4. EXT.net.dll in VS2010
    By amexus in forum 1.x Help
    Replies: 6
    Last Post: Jul 30, 2010, 8:37 PM
  5. Vs2010 Beta 2: "ext not recognized"
    By fabiomarcos in forum 1.x Help
    Replies: 5
    Last Post: Dec 03, 2009, 5:27 AM

Tags for this Thread

Posting Permissions