Salve a tutti ho creato una form logon.aspx una default.aspx regolarmente impostato il web.config e tutto funziona ok, ora vorrei che la pag. default.aspx mi inserisca nel db nome utente e data di accesso, ho scritto il codice nella load della pagina e anche qui tutto ok, solo che il codice in questione viene eseguito ogni volta che l'utente ritorna sulla pagina(essendo questa l' homepage) invece vorrei fare in modo che il codice sia eseguito solo quando effettuato l'accesso , ho provato in vari modi ma........non so + che pesci prendere. in classic asp avevo postato tramite form method post io mio valore che poi recuperavo con un request...ma qui non sembra funzionare.
grazie a tutti Vi posto il codice della logon.aspx
codice:<%@ Page Language="VB" %> <%@ Import Namespace="System.Web.Security" %> <script runat="server"> Sub Logon_Click(ByVal sender As Object, ByVal e As EventArgs) If ((UserEmail.Text = "xxxxx@tiscali.it") And _ (UserPass.Text = "xxxx")) Or ((UserEmail.Text = "xxxxxx@hotmail.it") And _ (UserPass.Text = "123456478")) Then FormsAuthentication.RedirectFromLoginPage _ (UserEmail.Text, Persist.Checked) Else Msg.Text = "Invalid credentials. Please try again." End If End Sub </script> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <title>Forms Authentication - Login</title> </head> <body> <form id="form1" runat="server"> <h3> Logon Page</h3> <table> <tr> <td> E-mail address:</td> <td> <asp:TextBox ID="UserEmail" runat="server" /></td> <td> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="UserEmail" Display="Dynamic" ErrorMessage="Cannot be empty." runat="server" /> </td> </tr> <tr> <td> Password:</td> <td> <asp:TextBox ID="UserPass" TextMode="Password" runat="server" /> </td> <td> <asp:RequiredFieldValidator ID="RequiredFieldValidator2" ControlToValidate="UserPass" ErrorMessage="Cannot be empty." runat="server" /> </td> </tr> <tr> <td> Ricordami</td> <td> <asp:CheckBox ID="Persist" runat="server" Width="99px" /></td> </tr> </table> <asp:Button ID="Submit1" OnClick="Logon_Click" Text="Log On" runat="server" /> <asp:Label ID="Msg" ForeColor="red" runat="server" /> </p> </form> </body> </html>

Rispondi quotando
