[CLOSED] ASP.NET MVC2 LogOn

  1. #1

    [CLOSED] ASP.NET MVC2 LogOn

    Hello,

    I'm developing an ASP.NET MVC2 application based on the coolite-mvc sample code.

    The Login method of the AccountController on the sample code reflects the ASP.NET MVC1 method signature:

    [AcceptVerbs(HttpVerbs.Post)]
    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings",
                Justification = "Needs to take same parameter type as Controller.Redirect()")]
    public ActionResult Login(string txtUsername, string txtPassword, string returnUrl)
    {
    .....
    }
    The Login method is invoked by the Login button in Login.aspx:

    ....
                <ext:Button runat="server" Text="Login" Icon="Accept">
                    <AjaxEvents>
                        <Click 
                            Url="/Account/Login/" 
                            Timeout="60000"
                            FormID="form1"
                            CleanRequest="true" 
                            Method="POST"
                            Before="Ext.Msg.wait('Verifying...', 'Authentication');"
                            Failure="Ext.Msg.show({
                               title:   'Login Error',
                               msg:     result.errorMessage,
                               buttons: Ext.Msg.OK,
                               icon:    Ext.MessageBox.ERROR
                            });">
                            <EventMask MinDelay="500" />
                            <ExtraParams>
                                <ext:Parameter Name="ReturnUrl" Value="Ext.urlDecode(String(&#100;ocument.location).split('?')[1]).r || '/'" Mode="Raw" />
                            </ExtraParams>
                        </Click>
                    </AjaxEvents>
                </ext:Button>
    ...

    How can I invoke the corresponding method in ASP.NET MVC2, in which username and password string parameters have been replaced by a LogOnModel object ?

    public ActionResult LogOn(LogOnModel model, string returnUrl)
    {
    ...
    }
    Thank you and regards.
  2. #2

    RE: [CLOSED] ASP.NET MVC2 LogOn

    Hi,

    I am not familiar with second version. Can you post test sample which demonstrates how to work with LogOnModel without Ext.NET?


    What advantages LogOnModel gives if compare with previous Login action (if we pass username and password to the action method)?
  3. #3

    RE: [CLOSED] ASP.NET MVC2 LogOn

    Hi Vladimir,

    I do not think there are particular advantages in the new LogOn action. Simply, the new ASP.NET MVC2 Web Application Visual Studio Template generates a different code. I attached le solution generated by the VS 2008 ASP.NET MVC2 Web Application template.
    My question concerns more generally the ability to invoke an action from an AjaxEvent passing an object parameter.

    By,
    Stefano
  4. #4

    RE: [CLOSED] ASP.NET MVC2 LogOn

    Hi,

    1. I think that if your fields have UserName and Password ids then you can use LogOnModel as action method argument


    My question concerns more generally the ability to invoke an action from an AjaxEvent passing an object parameter.

    It is better to redirect this question to the ASP.NET MVC forum because Ext.Net toolkit doesn't control action methods calling. It is ASP.NET MVC responsibility. I suppose that if MVC can mapping (mappingby name : control name -> property name) submitted value to the property then you can use object as action argument. But, again, it is depend how ASP.NET MVC calls action methods, you need to read ASP.NET MVC documentation to find the answer on that question

Similar Threads

  1. [CLOSED] Problem with MVC2 / .NET Framework 4.0
    By Stefanaccio in forum 1.x Legacy Premium Help
    Replies: 8
    Last Post: Nov 25, 2011, 7:16 AM
  2. how to implement Ext.net in MVC2 asp.et
    By hardik in forum 1.x Help
    Replies: 3
    Last Post: Sep 30, 2011, 11:06 AM
  3. [CLOSED] KeyMap Error MVC2
    By SymSure in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Mar 02, 2011, 8:35 PM
  4. Problem with GMapPanel in MVC2 using PartialViewResult
    By tiramisu in forum 1.x Legacy Premium Help
    Replies: 8
    Last Post: Nov 23, 2010, 7:56 AM
  5. [CLOSED] Set Focus to textfield in logon window
    By HOWARDJ in forum 1.x Legacy Premium Help
    Replies: 7
    Last Post: May 17, 2009, 9:41 PM

Posting Permissions