Error
-
Hi, I am getting the following error??? Please help??? ERROR: Server Error in '/Online_Book_Shopping' Application. ________________________________________ The remote name could not be resolved: 'smtp.gmail.com' Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Net.WebException: The remote name could not be resolved: 'smtp.gmail.com' Source Error: Line 60: smt.Port = 587; Line 61: smt.EnableSsl= true; Line 62: smt.Send(msg);//Error comes in this line of code Line 63: lblmsg.Text = "Username and Password Sent Successfully"; Line 64: lblmsg.ForeColor = System.Drawing.Color.ForestGreen; Source File: e:\Vijaya\Online_Book_Shopping\ForgetPassword.aspx.cs Line: 62 ============================================================================================= Following is the code:- using System.Net; using System.Net.Mail; using System.Drawing; using System.Configuration; using System.Data.SqlClient; using System.Data; public partial class ForgetPassword : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { string username = ""; string password = ""; string constr = ConfigurationManager.ConnectionStrings["CS"].ConnectionString; SqlConnection con = new SqlConnection(constr); { SqlCommand cmd = new SqlCommand("select Name, Password from dbo.RegisteredUsers where Email=@email", con); cmd.Parameters.AddWithValue("Email", txtemail.Text); con.Open(); using (SqlDataReader dr = cmd.ExecuteReader()) { if (dr.Read()) { username = dr["Name"].ToString(); password = dr["Password"].ToString(); } } con.Close(); if (!string.IsNullOrEmpty(username)) { MailMessage msg = new MailMessage(); msg.From = new MailAddress("nilusilu3@gmail.com"); msg.To.Add(txtemail.Text); msg.Subject = " Recover your Password"; msg.Body = ("Your Username is:" + username + "
" + "Your Pas
-
Hi, I am getting the following error??? Please help??? ERROR: Server Error in '/Online_Book_Shopping' Application. ________________________________________ The remote name could not be resolved: 'smtp.gmail.com' Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Net.WebException: The remote name could not be resolved: 'smtp.gmail.com' Source Error: Line 60: smt.Port = 587; Line 61: smt.EnableSsl= true; Line 62: smt.Send(msg);//Error comes in this line of code Line 63: lblmsg.Text = "Username and Password Sent Successfully"; Line 64: lblmsg.ForeColor = System.Drawing.Color.ForestGreen; Source File: e:\Vijaya\Online_Book_Shopping\ForgetPassword.aspx.cs Line: 62 ============================================================================================= Following is the code:- using System.Net; using System.Net.Mail; using System.Drawing; using System.Configuration; using System.Data.SqlClient; using System.Data; public partial class ForgetPassword : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { string username = ""; string password = ""; string constr = ConfigurationManager.ConnectionStrings["CS"].ConnectionString; SqlConnection con = new SqlConnection(constr); { SqlCommand cmd = new SqlCommand("select Name, Password from dbo.RegisteredUsers where Email=@email", con); cmd.Parameters.AddWithValue("Email", txtemail.Text); con.Open(); using (SqlDataReader dr = cmd.ExecuteReader()) { if (dr.Read()) { username = dr["Name"].ToString(); password = dr["Password"].ToString(); } } con.Close(); if (!string.IsNullOrEmpty(username)) { MailMessage msg = new MailMessage(); msg.From = new MailAddress("nilusilu3@gmail.com"); msg.To.Add(txtemail.Text); msg.Subject = " Recover your Password"; msg.Body = ("Your Username is:" + username + "
" + "Your Pas
First check if there is internet connection at all... Than try some changes in your code:
smt.UseDefaultCredentials = false;
smt.Credentials = new NetworkCredential("username", "password");
smt.DeliveryMethod = SmtpDeliveryMethod.Network;Skipper: We'll fix it. Alex: Fix it? How you gonna fix this? Skipper: Grit, spit and a whole lotta duct tape.
-
Hi, I am getting the following error??? Please help??? ERROR: Server Error in '/Online_Book_Shopping' Application. ________________________________________ The remote name could not be resolved: 'smtp.gmail.com' Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Net.WebException: The remote name could not be resolved: 'smtp.gmail.com' Source Error: Line 60: smt.Port = 587; Line 61: smt.EnableSsl= true; Line 62: smt.Send(msg);//Error comes in this line of code Line 63: lblmsg.Text = "Username and Password Sent Successfully"; Line 64: lblmsg.ForeColor = System.Drawing.Color.ForestGreen; Source File: e:\Vijaya\Online_Book_Shopping\ForgetPassword.aspx.cs Line: 62 ============================================================================================= Following is the code:- using System.Net; using System.Net.Mail; using System.Drawing; using System.Configuration; using System.Data.SqlClient; using System.Data; public partial class ForgetPassword : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { string username = ""; string password = ""; string constr = ConfigurationManager.ConnectionStrings["CS"].ConnectionString; SqlConnection con = new SqlConnection(constr); { SqlCommand cmd = new SqlCommand("select Name, Password from dbo.RegisteredUsers where Email=@email", con); cmd.Parameters.AddWithValue("Email", txtemail.Text); con.Open(); using (SqlDataReader dr = cmd.ExecuteReader()) { if (dr.Read()) { username = dr["Name"].ToString(); password = dr["Password"].ToString(); } } con.Close(); if (!string.IsNullOrEmpty(username)) { MailMessage msg = new MailMessage(); msg.From = new MailAddress("nilusilu3@gmail.com"); msg.To.Add(txtemail.Text); msg.Subject = " Recover your Password"; msg.Body = ("Your Username is:" + username + "
" + "Your Pas
It is no wonder so much hacking continues when people still store passwords in clear text. Please read Secure Password Authentication Explained Simply[^] and use some proper security on your site. You should also not send passwords via email, there are better, more secure methods, of resetting a user password.
-
Hi, I am getting the following error??? Please help??? ERROR: Server Error in '/Online_Book_Shopping' Application. ________________________________________ The remote name could not be resolved: 'smtp.gmail.com' Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Net.WebException: The remote name could not be resolved: 'smtp.gmail.com' Source Error: Line 60: smt.Port = 587; Line 61: smt.EnableSsl= true; Line 62: smt.Send(msg);//Error comes in this line of code Line 63: lblmsg.Text = "Username and Password Sent Successfully"; Line 64: lblmsg.ForeColor = System.Drawing.Color.ForestGreen; Source File: e:\Vijaya\Online_Book_Shopping\ForgetPassword.aspx.cs Line: 62 ============================================================================================= Following is the code:- using System.Net; using System.Net.Mail; using System.Drawing; using System.Configuration; using System.Data.SqlClient; using System.Data; public partial class ForgetPassword : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { string username = ""; string password = ""; string constr = ConfigurationManager.ConnectionStrings["CS"].ConnectionString; SqlConnection con = new SqlConnection(constr); { SqlCommand cmd = new SqlCommand("select Name, Password from dbo.RegisteredUsers where Email=@email", con); cmd.Parameters.AddWithValue("Email", txtemail.Text); con.Open(); using (SqlDataReader dr = cmd.ExecuteReader()) { if (dr.Read()) { username = dr["Name"].ToString(); password = dr["Password"].ToString(); } } con.Close(); if (!string.IsNullOrEmpty(username)) { MailMessage msg = new MailMessage(); msg.From = new MailAddress("nilusilu3@gmail.com"); msg.To.Add(txtemail.Text); msg.Subject = " Recover your Password"; msg.Body = ("Your Username is:" + username + "
" + "Your Pas
Don't send email via gmail, don't send passwords via email, don't store passwords in clear text. Literally everything you are doing are things you shouldn't do. As for the error it is a network error, nothing to do with your code and nothing that can be solved with code. Google the error for more info.
-
Hi, I am getting the following error??? Please help??? ERROR: Server Error in '/Online_Book_Shopping' Application. ________________________________________ The remote name could not be resolved: 'smtp.gmail.com' Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Net.WebException: The remote name could not be resolved: 'smtp.gmail.com' Source Error: Line 60: smt.Port = 587; Line 61: smt.EnableSsl= true; Line 62: smt.Send(msg);//Error comes in this line of code Line 63: lblmsg.Text = "Username and Password Sent Successfully"; Line 64: lblmsg.ForeColor = System.Drawing.Color.ForestGreen; Source File: e:\Vijaya\Online_Book_Shopping\ForgetPassword.aspx.cs Line: 62 ============================================================================================= Following is the code:- using System.Net; using System.Net.Mail; using System.Drawing; using System.Configuration; using System.Data.SqlClient; using System.Data; public partial class ForgetPassword : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { string username = ""; string password = ""; string constr = ConfigurationManager.ConnectionStrings["CS"].ConnectionString; SqlConnection con = new SqlConnection(constr); { SqlCommand cmd = new SqlCommand("select Name, Password from dbo.RegisteredUsers where Email=@email", con); cmd.Parameters.AddWithValue("Email", txtemail.Text); con.Open(); using (SqlDataReader dr = cmd.ExecuteReader()) { if (dr.Read()) { username = dr["Name"].ToString(); password = dr["Password"].ToString(); } } con.Close(); if (!string.IsNullOrEmpty(username)) { MailMessage msg = new MailMessage(); msg.From = new MailAddress("nilusilu3@gmail.com"); msg.To.Add(txtemail.Text); msg.Subject = " Recover your Password"; msg.Body = ("Your Username is:" + username + "
" + "Your Pas
Troy Hunt: Everything you ever wanted to know about building a secure password reset feature[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer