1. #201
    Ext JS Premium Member
    Join Date
    Jul 2009
    Location
    Seattle, Washington USA
    Posts
    200
    Vote Rating
    0
    geewhizbang is on a distinguished road

      0  

    Default


    Quote Originally Posted by prumbles View Post
    I just can't seem to figure this one out. I've tested it multiple times on my web site. I've set the session timeout to 2 minutes, and created the Session_End method in Global.asax to test when the session ends. Anytime I run an AJAX Ext.Direct method, the session ends 2 minutes later. Is it possible I have something set up differently that is causing this. Even though this IS the behavior I want, I can't expect this to be consistent if you say this should NOT be the case. What do you think is going on here?
    It looks like this behavior is due to the way I am caching a small object in session:

    Code:
    public class ContextManager
    {
        Dictionary <string, Context> dictContext;
        Dictionary <string, string> dictQueryMap;
    
        private ContextManager() { }
    
        private HttpSessionStateBase _Session;
        public ContextManager(HttpSessionState Session)
        {
            _Session = new HttpSessionStateWrapper(Session);
            init();
        }    
    
        public ContextManager(HttpSessionStateBase Session)
        {
            _Session = Session;
            init();
        }
    
        private void init()
        {
            dictContext = new  Dictionary<string, Context>();
            dictQueryMap = new Dictionary<string,string>();
        }
    
        public Context Context(string Query)
        {
            string PortalId = null;
            string ClientId = null;
            Context kbContext = null;
    
            if (dictQueryMap.ContainsKey(Query))
            {
                PortalId = dictQueryMap[Query];
            }
            else
            {
                string [] aQ1 = 
                    Utility.FixNull(Utility.Extract(Query, "?", null), "").Split('&');
                for (int i=0; i < aQ1.Length && PortalId == null ; i++)
                {
                    string [] aQ2 = aQ1[i].Split('=');
                    if (aQ2.Length == 2)
                    {
                        switch (aQ2[0].ToLower())
                        {
                            case "cid" : case "portalid" :
                                PortalId = aQ2[1].Split('#')[0];
                                break;
    
                            case "c" : case "clientid" :
                                ClientId = aQ2[1].Split('#')[0];
                                break;
                        }
                    }
                }
                if (PortalId == null)
                {
                    if (_Session["DefaultPortal"] == null)
                    {
                        kbContext = new Context(_Session);
                        kbContext.SetPortal(Utility.FixNullInt(ClientId, -1), -1);
                        if (kbContext.PortalId == -1)
                        {
                            HttpContext.Current.Response.Redirect
                               ("/kbError.aspx?msg=1", true);
                        }
                        _Session.Add("DefaultPortal", kbContext.PortalId.ToString());
                    }
                    PortalId = Utility.FixNull(_Session["DefaultPortal"], "-1");
                }
                if (!dictContext.ContainsKey(PortalId))
                {
                    if (kbContext == null) kbContext = new Context(_Session);
                    dictContext.Add(PortalId, kbContext);
                }
            }
            kbContext = dictContext[PortalId];
            kbContext.UpdateUserCookie();
            return kbContext;
        }
    }
    public class Context
    {
        private HttpSessionStateBase _Session;
        private Context() { }
        public DateTime LastTransactionDate;
    
        public Context(HttpSessionStateBase Session)
        {
            _Session = Session;
        }
     
        // and several methods and properties here
    }
    This was done so that someone could be logged into more than one portal at the same time and each portal would get a separate context object, which contains the security info for our app. Some portals can be secured, others open, so we needed a way to keep them separate without having them on different URLs. The ContextManager class is used to retrieve the correct context on all three situations: MasterPage, ViewPage, and DirectRequest controller calls by parsing the URLs. The Context Manager is stored in session.

    We were having problems with session going away and it mysteriously disappeared, probably about the same time I implemented this.

  2. #202
    Ext User
    Join Date
    Mar 2010
    Posts
    1
    Vote Rating
    0
    niklasringdahl is on a distinguished road

      0  

    Default Portal use?

    Portal use?


    Hi!

    This looks really awesome! I love ExtJS and have been looking for a way to use it together with my C# skills to build a portal solution.

    Is this approach good for building a web portal application? User handling, preventing DoS attacks, editorial patterns and so on?

    So far, I have been looking at dropthings, a portal demo that looks good on the server side, but lacks a lot on the UI side.

    Any suggestions or commens?

    Thanks! (can't wait to try this!)
    - Niklas

  3. #203
    Ext User
    Join Date
    Mar 2007
    Posts
    108
    Vote Rating
    0
    pomata is on a distinguished road

      0  

    Default 404

    404


    Hi There,

    Is there a reason why everything works on my machine but not on shared hosting?
    I get a 404 for "Direct/Api" url.

    Many thanks

    Regards

  4. #204
    Ext User
    Join Date
    Mar 2010
    Posts
    1
    Vote Rating
    0
    oliveiraethales is on a distinguished road

      0  

    Default


    Hello!

    First of all, thanks for creating this server stack for ASP.NET MVC, it's been very helpful!

    I have a newbie question, but let's go. I'm simply trying to submit a Form that's inside a Window, calling a Register method o the Controller. But when I click the submit button, a JS exception is thrown, it doesn't even reach the controller. (Btw, 'get' operations works fine, like in the example project). Below is the code I'm currently using and the exception.

    ExtJS Window:
    Code:
    Ext.namespace("MPD.UI");
    
    CadastrarVoluntarios = Ext.extend(Ext.Window,
    {
        constructor: function(config)
        {
            config = Ext.apply({
                id: 'window-cadastrarvoluntarios',
                closeAction: 'hide',
                collapsible: true,
                closable: true,
                resizable: false,
                title: 'Cadastrar Voluntários',
                border: false,
                height: 300,
                width: 500,
                items: [{
                    xtype: 'form',
                    id: 'form-cadastrarvoluntarios',
                    labelWidth: 75,
                    items: [{
                        xtype: 'fieldset',
                        defaultType: 'textfield',
                        items: [{
                            fieldLabel: 'Nome',
                            name: 'nome',
                            allowBlank: false
                        }, {
                            fieldLabel: 'Endere├žo',
                            name: 'endereco',
                            allowBlank: false
                        }, {
                            fieldLabel: 'E-mail',
                            name: 'email',
                            vtype: 'email'
                        }, {
                            fieldLabel: 'Telefone',
                            name: 'telefone'
                        }, {
                            fieldLabel: 'Celular',
                            name: 'celular'
                        }]
                    }],
                    buttons:
                    [{
                        text: 'Cadastrar',
                        type: 'submit',
                        handler: function()
                        {
                            this.ownerCt.ownerCt.getForm().submit({
                                params: {
                                    nome: 'nome',
                                    endereco: 'endereco',
                                    telefone: 'telefone',
                                    celular: 'celular',
                                    email: 'email'
                                }
                            });
                        }
                    }]
                }],
                
                api: 
                {
                    submit: Voluntarios.Cadastrar
                },
                
                paramOrder: ['nome','endereco', 'telefone', 'celular', 'email']
            }, config);
           
            CadastrarVoluntarios.superclass.constructor.call(this, config);
        },
    
        parent: null,
        
        init: function(parent)
        {
            this.parent = parent;
            parent.cadastrarVoluntarios = this;
        }
    });
    Controller:
    Code:
    namespace MaisPertoDeDeus.Controllers
    {
        public class VoluntariosController : Controller
        {
            [FormHandler]
            public ActionResult Cadastrar(string nome, string endereco, int telefone, int celular, string email)
            {
                return this.Direct(null);
            }
        }
    }
    Any help is appreciated. Thanks in advance!

  5. #205
    Ext JS Premium Member
    Join Date
    Mar 2010
    Posts
    179
    Vote Rating
    0
    steffen.rahn is on a distinguished road

      0  

    Default


    I've got the following Problem while using linq with stored procedures:

    I convert the ISingelResult with AsQueryable() to IQueriable but I alsways get a
    The query results cannot be enumerated more than onceException.

    When I got it right, I have to create a ISingeResult wrapper class? Is that the right way or is there a better way?

    @oliveiraethales:
    Maybe I am blind, but I dont see the exception text...

    @pomata:
    Is there the correct path in your view? Try Url.Content("~/Direct/Api")
    Othwise check if there are no restrictions that prevent the provider registration

  6. #206
    Ext JS Premium Member
    Join Date
    Mar 2010
    Posts
    179
    Vote Rating
    0
    steffen.rahn is on a distinguished road

      0  

    Default


    Who ever get's the same Problem; ToList() works quite fine. I only tried it twice (I forgot the second statement in the other class), what cause the whole thing to explode.

  7. #207
    Sencha User
    Join Date
    Mar 2007
    Posts
    767
    Vote Rating
    1
    franklt69 is on a distinguished road

      0  

    Default


    Using Ext.Direct.Mvc.dll 2.0.0.0 locally all work ok when I upload the application to the server I get this error":


    provider is undefined
    [Break on this error] if(!provider.events){

    the error happen here

    Ext.Direct.addProvider(Ext.app.REMOTING_API);
    with firebug I can see Ext.app.REMOTING_API = null

    in the web config I have:

    PHP Code:
    ?xml version="1.0"?>
    <configuration>
        <configSections>
            <section name="ext.direct" type="Ext.Direct.Mvc.Configuration.DirectSection, Ext.Direct.Mvc" />
        </configSections>
    [B]    <ext.direct
            providerName="Ext.app.REMOTING_API"
            assembly="ET.BS.Admin"
            dateFormat="Iso"
            debug="true"
        />
    [/B]    <connectionStrings>
          <!--  <add name="SampleConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Sample.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient" /> -->
          <!--<add name="SampleConnectionString" connectionString="Data Source=SAFETYPAY-DEV1;Initial Catalog=SAMPLE.MDF;Integrated Security=True" /> -->
          <add name="mySQLConnectionString" connectionString="server=localhost;user id=root; password=; database=etdb"/>
        </connectionStrings>
        <system.web>
            <compilation debug="true">
                <assemblies>
                    <add assembly="System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
                </assemblies>
            </compilation>
            <authentication mode="None" />
            <pages>
                <namespaces>
                    <add namespace="System.Web.Mvc"/>
                    <add namespace="System.Web.Mvc.Html"/>
                    <add namespace="System.Web.Routing"/>
                </namespaces>
            </pages>
            <httpModules>
                <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
            </httpModules>
        </system.web>
        <system.codedom>
            <compilers>
                <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
                    <providerOption name="CompilerVersion" value="v3.5"/>
                    <providerOption name="WarnAsError" value="false"/>
                </compiler>
            </compilers>
        </system.codedom>
        <!-- 
            The system.webServer section is required for running ASP.NET AJAX under Internet
            Information Services 7.0.  It is not necessary for previous version of IIS.
        -->
        <system.webServer>
            <validation validateIntegratedModeConfiguration="false"/>
            <modules runAllManagedModulesForAllRequests="true">
                <remove name="UrlRoutingModule" />
                <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
            </modules>
            <handlers>
                <remove name="MvcHttpHandler" />
                <remove name="UrlRoutingHandler" />
                <add name="MvcHttpHandler" preCondition="integratedMode" verb="*" path="*.mvc" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=1.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" />
            </handlers>
        </system.webServer>
    </configuration> 

    I ma missing somethig?

    a little help is welcome

    Regards
    Frank

  8. #208
    Sencha User
    Join Date
    Mar 2007
    Posts
    767
    Vote Rating
    1
    franklt69 is on a distinguished road

      0  

    Default


    where I found information about to use the latest version of Ext.Direct.Mvc and MVC1 because I think the server where I am deploying don't support mvc2, but I need the setting in the web.config too because I am confused

    regards
    Frank

  9. #209
    Sencha User
    Join Date
    Mar 2007
    Posts
    767
    Vote Rating
    1
    franklt69 is on a distinguished road

      0  

    Default


    I need some help, how I can detect where is the error:
    provider is undefined
    [Break on this error] if(!provider.events){


    IN Firebug I saw http://lxxxx/Admin1/Direct/Api 500 Internal Server Error
    I was testing in rackspace hosting, an app using ext.direct.mvc 0.6.2 and it worked ok, now I deployed the demo application (Ext.Direct.Mvc.Demo) using version 2 but MVC1 and I get in the cloud this error:

    HTML Code:
     <b> Description: </b>The application attempted to perform an operation not allowed by the security policy. &nbsp;To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.
                <br><br>
    
    <b> Exception Details: </b>System.Security.SecurityException: That assembly does not allow partially trusted callers.<br><br>
    so someone had has this error?

    regards
    Frank

  10. #210
    Sencha User
    Join Date
    Dec 2007
    Posts
    17
    Vote Rating
    0
    aritchie is on a distinguished road

      0  

    Default


    The assembly needs the following attribute (usually in AssemblyInfo.cs)

    [assembly: AllowPartiallyTrustedCallers]