1. #231
    Sencha User
    Join Date
    Jan 2010
    Posts
    5
    Vote Rating
    0
    zam6ak is on a distinguished road

      0  

    Default


    @elishnvsky - Very nice, thank you!

  2. #232
    Sencha User bt_bruno's Avatar
    Join Date
    Mar 2008
    Location
    Redwood City, CA
    Posts
    154
    Vote Rating
    10
    bt_bruno will become famous soon enough

      0  

    Default


    Quote Originally Posted by halcwb View Post
    I keep running in a System.NullReferenceException: DirectRequest is null exception. I post a form to the following controller:

    Code:
    [FormHandler]
            [ValidateInput(false)]
            public ActionResult GenFormLogin(string user, string password)
            {
                bool login = (Informedica.GenForm.Library.Security.
                               GenFormPrincipal.Login(user, password));
    
                //return this.Direct(new LoginResponse(login, "failure"));
                return this.Direct(RoleNameList.GetNameValueList());
            }
    
            [Serializable]
            private class LoginResponse
            {
                private bool _Success;
                private string _Title;
    
                public LoginResponse(bool success, string title)
                {
                    _Success = success;
                    _Title = title;
                }
    
                public bool Success
                {
                    get { return _Success; }
                    set { ;}
                }
    
                public string Title
                {
                    get { return _Title; }
                    set { ;}
                }
            }
    When I debug my code, the program passes the controller code without problems. But in my webbrowser I get the null reference exception. The javascript code I use to submit the form is:

    Code:
                    handler : function() {
                        loginForm.getForm().submit({
                                    success : function(f, a) {
                                        debugger;
                                        Ext.Msg.alert('Success', 'It worked');
                                    },
                                    failure : function(f, a) {
                                        debugger;
                                        Ext.Msg.alert('Warning', a.failureType);
                                    }
                                });
                    }
    But I do not think the problem is not on the client side but in my this.Direct return object. I also tried passing a null, boolean, string, anonymous class like : new { succes = true, title: "failure} etc...

    Any help will be greatly appreciated.

    I got this error too

    Code:
    public ActionResult Index()
    {
        var response = new
        {
            totalCount = 20,
            root = new object[]{
                new { Name = "Client 1" },
                new { Name = "Client 2" },
                new { Name = "Client 3" },
            }
        };
    
        return this.Direct(response);
    }

    P.S.: this asp.net mvc ext direct implementation is awesome!

  3. #233
    Sencha User
    Join Date
    Jun 2010
    Posts
    47
    Vote Rating
    0
    dan_b is on a distinguished road

      0  

    Default


    Quote Originally Posted by bt_bruno View Post
    I got this error too
    The clue is in the error "DirectRequest is null". Are you going via the Ext Direct API or straight to the controller action?

  4. #234
    Ext User
    Join Date
    Aug 2007
    Posts
    8
    Vote Rating
    0
    cracknix is on a distinguished road

      0  

    Default


    hi,

    how to register my controller to the api....

    i did everything same like on the MVC Solution, but on the Demo i get
    Code:
    <script type="text/javascript" src="<% = Url.Content("~/Direct/Api") %>"></script>
    Ext.app.REMOTING_API={   "url": "/Direct/Router",   "type": "remoting",   "actions": {     "Test": [       {         "name": "SayHello",         "len": 0       },       {         "name": "EchoDate",         "len": 1       },       {         "name": "AddNumbers",
    on my own project for the same come

    Code:
    <script type="text/javascript" src="<% = Url.Content("~/Direct/Api") %>"></script>
    
    Ext.app.REMOTING_API={   "url": "/Direct/Router",   "type": "remoting",   "actions": {     "Direct": [       {         "name": "Api",         "len": 0       },       {         "name": "Router",         "len": 0       }     ]   } };
    
    Error: Test is not defined
    How to register TestController to the API?

    Webconfig:

    <configSections>
    <section name="ext.direct" type="Ext.Direct.Mvc.Configuration.DirectSection, Ext.Direct.Mvc"/>
    </configSections>
    <ext.direct providerName="Ext.app.REMOTING_API" assembly="Ext.Direct.Mvc" dateFormat="Iso" debug="true"/>

  5. #235
    Sencha User
    Join Date
    Jun 2010
    Posts
    47
    Vote Rating
    0
    dan_b is on a distinguished road

      0  

    Default


    <configSections>
    <section name="ext.direct" type="Ext.Direct.Mvc.Configuration.DirectSection, Ext.Direct.Mvc"/>
    </configSections>
    <ext.direct providerName="Ext.app.REMOTING_API" assembly="Ext.Direct.Mvc" dateFormat="Iso" debug="true"/>[/QUOTE]

    assembly="Ext.Direct.Mvc" should be assembly="Your.Controllers.Assembly"

  6. #236
    Ext User
    Join Date
    Oct 2010
    Posts
    1
    Vote Rating
    0
    Zarathustra is on a distinguished road

      0  

    Default


    Hi all,

    I've some problems to make the configuration works. I have a web project and another controller project in my solution. I read the tutorial and configure my web.config as it should be. My problem is when I try to add the provider under Ext.onReady function, I get an error like :
    'events' is Null or not an objet
    This is coming from the addProvider method of the ext-all file. I think ext is not encountering the assembly of my controller project (I checked all the names dozen of times) cause the provider parameter of the addProvider method is received undefined...

    I have downloaded the test project available with Ext.Direct.Mvc and it runs well. Actually, I'm sure the problem is the assembly because putting a wrong name in the web.config of the demo solution cause the same issue. But I'm sure I have my assembly name correct....

    Any suggestion would be appreciated

  7. #237
    Sencha Premium Member
    Join Date
    Sep 2008
    Posts
    710
    Vote Rating
    6
    Bucs is on a distinguished road

      0  

    Default


    Getting ready to jump into MVC and Direct for the first time as I think the pattern is pretty cool and here to stay, especially since ExtJS (err Sencha) apps don't really use ASP.net controls or the Server Page Event model. Will this implementation of Ext.Direct for ASP.NET MVC work fine with the new ASP.NET MVC 3, or are they any breaking changes or gotchas? From my understanding, most of the new stuff is related to Views which I wouldn't use anyway, but always nice to start with the latest. The JSON binding improvements seem nice though.

    Suggestions, comments appreciated!

    Thanks...

  8. #238
    Sencha User
    Join Date
    Jun 2010
    Posts
    47
    Vote Rating
    0
    dan_b is on a distinguished road

      0  

    Default


    No problems using this with MVC 2 and 3.

    I only have one view in my projects, Home/Index which pulls in all the js files. Extjs is essentially the V in my MVC, with my controllers only returning snippets of JSON. I really really like the way this separates the UI from business logic and data access in the controllers - I could, say, swap out my backend for a PHP one and as long as it returned the same data the front end would be blissfully unaware.

    And yes, most of the new stuff in MVC 3 I don't use either.

  9. #239
    Sencha Premium Member
    Join Date
    Sep 2008
    Posts
    710
    Vote Rating
    6
    Bucs is on a distinguished road

      0  

    Default


    After a pretty decent review of MVC, I love the pattern, looks very powerful and flexible. The one issue that I cannot really find a whole lot of info on, especially in regards to the Ext.Direct ASP.NET MVC router calls, is security. I've read the few articles on the MVC site, but they are pretty basic and gloss over a lot of the details by just telling you to use the Membership provider. I am not a big fan of that provider number one, and number two I am bolting on a new external web application to pull data from an internal web applicaiton (thru firewall) and will have to authenticate against the internal app's business security layer, passing in username/password.

    My question really has sseveral parts:
    1) How do you protect an entire MVC project's controller actions via Forms authentication, i.e. require that the user is authenticated before allowing use?
    2) What is best way to do forms authentication for an MVC app, include a webform in the MVC project?
    3) Is your only choice to implement the standard or a custom Membership Provider?
    3) If I performed my own authentication methodology and created my own form auth ticket and then added this ticket t the context via context.Response.Cookies.Add(authCookie), does this get passed back and forth with the Direct calls or can I do something to make this happen?

    Sorry for the lame questions on this...kinda clueless on how to get security working in this environment after coming form the ASP.Net world.

    Thanks for any direction!

  10. #240
    Sencha User
    Join Date
    Jun 2010
    Posts
    47
    Vote Rating
    0
    dan_b is on a distinguished road

      0  

    Default


    In MVC security is pretty much left up to you to handle.

    1) FormsAuthentication.SetAuthCookie(username, false); then slap an
    [Authorize] attribute on your controller or action.

    2) See above.

    3) Not at all

    4) Absolutely, see (1). It's as simple as that.

    You probably want to read this and this regarding unauthorized requests.