Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Dec 28, 2012 06:07 PM by cms9651
Member
176 Points
580 Posts
Dec 28, 2012 02:27 PM|LINK
how to allow login in with email using the asp OnAuthenticate
how to customize the language of the form?
I tried this but I see english language:
<%@ Page UICulture="es" Culture="es-MX" Language="C#" AutoEventWireup="true" CodeFile="Login.aspx.cs" Inherits="Login" %>
thanks
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Login.aspx.cs" Inherits="Login" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> <asp:Login ID="Login1" runat="server" OnAuthenticate="Login1_Authenticate"> </asp:Login> </div> </form> </body> </html> using System; using System.Collections.Generic; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data.SqlClient; using System.IO; using System.Data; using System.Data.Odbc; using System.Configuration; using System.Collections; using System.ComponentModel; using System.Drawing; using System.Web.Security; using System.Web.SessionState; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls.WebParts; public partial class Login : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void Login1_Authenticate(object sender, AuthenticateEventArgs e) { string email = Login1.UserName; string pwd = Login1.Password; OdbcConnection conn = new OdbcConnection(ConfigurationManager.ConnectionStrings["cs"].ConnectionString); conn.Open(); string sqlUserName; sqlUserName = "SELECT "; sqlUserName = sqlUserName + "email "; sqlUserName = sqlUserName + ",password1 "; sqlUserName = sqlUserName + "FROM tbl_login "; sqlUserName = sqlUserName + "WHERE email = ? "; sqlUserName = sqlUserName + "AND password1 = ?;"; OdbcCommand cmd = new OdbcCommand(sqlUserName, conn); cmd.Parameters.Add("?", email); cmd.Parameters.Add("?", pwd); string CurrentName; CurrentName = (string)cmd.ExecuteScalar(); if (CurrentName != null) { Session["UserAuthentication"] = email; Session.Timeout = 1; Response.Redirect("start.aspx"); } else { Session["UserAuthentication"] = ""; } conn.Close(); conn.Dispose(); } }
Dec 28, 2012 06:07 PM|LINK
http://www.dotnetfunda.com/tutorials/controls/login.aspx
cms9651
Member
176 Points
580 Posts
how to allow login in with email using the asp OnAuthenticate
Dec 28, 2012 02:27 PM|LINK
how to allow login in with email using the asp OnAuthenticate
how to customize the language of the form?
I tried this but I see english language:
<%@ Page UICulture="es" Culture="es-MX" Language="C#" AutoEventWireup="true" CodeFile="Login.aspx.cs" Inherits="Login" %>thanks
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Login.aspx.cs" Inherits="Login" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> <asp:Login ID="Login1" runat="server" OnAuthenticate="Login1_Authenticate"> </asp:Login> </div> </form> </body> </html> using System; using System.Collections.Generic; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data.SqlClient; using System.IO; using System.Data; using System.Data.Odbc; using System.Configuration; using System.Collections; using System.ComponentModel; using System.Drawing; using System.Web.Security; using System.Web.SessionState; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls.WebParts; public partial class Login : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void Login1_Authenticate(object sender, AuthenticateEventArgs e) { string email = Login1.UserName; string pwd = Login1.Password; OdbcConnection conn = new OdbcConnection(ConfigurationManager.ConnectionStrings["cs"].ConnectionString); conn.Open(); string sqlUserName; sqlUserName = "SELECT "; sqlUserName = sqlUserName + "email "; sqlUserName = sqlUserName + ",password1 "; sqlUserName = sqlUserName + "FROM tbl_login "; sqlUserName = sqlUserName + "WHERE email = ? "; sqlUserName = sqlUserName + "AND password1 = ?;"; OdbcCommand cmd = new OdbcCommand(sqlUserName, conn); cmd.Parameters.Add("?", email); cmd.Parameters.Add("?", pwd); string CurrentName; CurrentName = (string)cmd.ExecuteScalar(); if (CurrentName != null) { Session["UserAuthentication"] = email; Session.Timeout = 1; Response.Redirect("start.aspx"); } else { Session["UserAuthentication"] = ""; } conn.Close(); conn.Dispose(); } }cms9651
Member
176 Points
580 Posts
Re: how to allow login in with email using the asp OnAuthenticate
Dec 28, 2012 06:07 PM|LINK
http://www.dotnetfunda.com/tutorials/controls/login.aspx