This is my LogOn code
<body>
<ext:ResourceManager ID="MainScriptManager" runat="server" />
<ext:Window
ID="LogOnWindow"
runat="server"
Closable="false"
Resizable="false"
Height="150"
Icon="Lock"
Title="MyApp - Logon"
Draggable="true"
Width="300"
Modal="true"
Layout="FitLayout"
BodyStyle="padding:17px 15px 17px 15px;"
ButtonAlign="Center">
<Items>
<ext:FormPanel
runat="server"
DefaultButton="btnLogOn"
DefaultButtonStopEvent="true"
FormID="formLogOn"
Border="false"
Layout="FormLayout"
BodyStyle="background:transparent;"
Url='<%# Html.AttributeEncode(Url.Action("LogOn")) %>'>
<AutoEl Tag="Form" />
<Items>
<ext:TextField
ID="txtUsername"
runat="server"
AutoFocus="true"
AutoFocusDelay="150"
FieldLabel="Nome Utente"
AllowBlank="false"
BlankText="Nome Utente obbligatorio."
AnchorHorizontal="100%" />
<ext:TextField
ID="txtPassword"
runat="server"
InputType="Password"
FieldLabel="Password"
AllowBlank="false"
BlankText="Password obbligatoria."
AnchorHorizontal="100%" />
</Items>
</ext:FormPanel>
</Items>
<Buttons>
<ext:Button ID="btnLogOn" runat="server" Text="Logon" Icon="Accept">
<DirectEvents>
<Click
Url="~/Account/LogOn/"
Timeout="10000"
FormID="formLogOn"
CleanRequest="true"
Method="POST"
Before="Ext.Msg.wait('Autenticazione in corso...', 'Logon');"
Failure="Ext.Msg.show({
title: 'Errore in fase di Logon',
msg: result.errorMessage,
buttons: Ext.Msg.OK,
icon: Ext.MessageBox.ERROR,
fn: function(btn) { #{txtUsername}.focus(false, 100); }
})">
<EventMask MinDelay="250" />
</Click>
</DirectEvents>
</ext:Button>
<ext:Button ID="btnCancel" runat="server" Text="Annulla" Icon="Decline">
<Listeners>
<Click Handler="#{LogOnWindow}.hide();" />
</Listeners>
</ext:Button>
</Buttons>
</ext:Window>
This is my AccountController Code
...
[HttpPost]
[UserHostAddress]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings",
Justification = "Needs to take same parameter type as Controller.Redirect()")]
public ActionResult LogOn(string txtUsername, string txtPassword, /* string returnUrl, */ string userHostAddress)
{
string licenseError = null;
if (!Core.LicenseHelper.CheckLicense(out licenseError))
{
return new AjaxResult { ErrorMessage = licenseError };
}
...
}
...
The issue is that txtUserName and txtPassword are always null when passed into Controller.
Update: Please look also at the runtime generated code... Ext Net 1.x makes different html code...