Click here to Skip to main content
15,885,365 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Return message to user if file already exists Pin
F-ES Sitecore22-May-17 22:59
professionalF-ES Sitecore22-May-17 22:59 
GeneralRe: Return message to user if file already exists Pin
Hamiltonian1324-May-17 8:14
Hamiltonian1324-May-17 8:14 
QuestionSingleton Class in Asp.net application Pin
Rafique Abdullah19-May-17 21:54
Rafique Abdullah19-May-17 21:54 
AnswerRe: Singleton Class in Asp.net application Pin
Nathan Minier20-May-17 12:43
professionalNathan Minier20-May-17 12:43 
GeneralRe: Singleton Class in Asp.net application Pin
Rafique Abdullah22-May-17 7:15
Rafique Abdullah22-May-17 7:15 
GeneralRe: Singleton Class in Asp.net application Pin
F-ES Sitecore22-May-17 22:50
professionalF-ES Sitecore22-May-17 22:50 
QuestionHow to populate dropdownlist in the partial view, base upon the selection of another dropdown value in the view, using angular js Pin
Member 1318632317-May-17 20:16
Member 1318632317-May-17 20:16 
QuestionError Pin
Member 1116162516-May-17 20:10
Member 1116162516-May-17 20:10 
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 + "<br/><br/>" + "Your Password is:" + password);
            msg.IsBodyHtml = true;

            SmtpClient smt = new SmtpClient();
            smt.Host = "smtp.gmail.com";
            System.Net.NetworkCredential ntwd = new NetworkCredential();
            ntwd.UserName = "nilusilu3@gmail.com"; //Your Email ID<br />
            ntwd.Password = ""; // Your Password<br />
            smt.UseDefaultCredentials = true;
            smt.Credentials = ntwd;
            smt.Port = 587;
            smt.EnableSsl= true;
            smt.Send(msg);
            lblmsg.Text = "Username and Password Sent Successfully";
            lblmsg.ForeColor = System.Drawing.Color.ForestGreen;
        }
    }

}

}
AnswerRe: Error Pin
Kornfeld Eliyahu Peter16-May-17 21:27
professionalKornfeld Eliyahu Peter16-May-17 21:27 
AnswerRe: Error Pin
Richard MacCutchan16-May-17 21:36
mveRichard MacCutchan16-May-17 21:36 
AnswerRe: Error Pin
F-ES Sitecore16-May-17 22:11
professionalF-ES Sitecore16-May-17 22:11 
SuggestionRe: Error Pin
Richard Deeming17-May-17 1:24
mveRichard Deeming17-May-17 1:24 
QuestionTelerik version upgradation issue in Asp.net Pin
Member 1058746112-May-17 1:28
Member 1058746112-May-17 1:28 
SuggestionRe: Telerik version upgradation issue in Asp.net Pin
Richard Deeming12-May-17 4:08
mveRichard Deeming12-May-17 4:08 
QuestionGetting the Excepption ExceptionType Newtonsoft.Json.JsonSerializationException in my Web API Pin
indian14311-May-17 8:56
indian14311-May-17 8:56 
SuggestionRe: Getting the Excepption ExceptionType Newtonsoft.Json.JsonSerializationException in my Web API Pin
ZurdoDev11-May-17 9:15
professionalZurdoDev11-May-17 9:15 
GeneralRe: Getting the Excepption ExceptionType Newtonsoft.Json.JsonSerializationException in my Web API Pin
indian14311-May-17 11:20
indian14311-May-17 11:20 
GeneralRe: Getting the Excepption ExceptionType Newtonsoft.Json.JsonSerializationException in my Web API Pin
ZurdoDev12-May-17 0:46
professionalZurdoDev12-May-17 0:46 
SuggestionRe: Getting the Excepption ExceptionType Newtonsoft.Json.JsonSerializationException in my Web API Pin
Richard Deeming12-May-17 1:19
mveRichard Deeming12-May-17 1:19 
GeneralRe: Getting the Excepption ExceptionType Newtonsoft.Json.JsonSerializationException in my Web API Pin
indian14317-May-17 7:16
indian14317-May-17 7:16 
GeneralRe: Getting the Excepption ExceptionType Newtonsoft.Json.JsonSerializationException in my Web API Pin
Richard Deeming17-May-17 7:30
mveRichard Deeming17-May-17 7:30 
GeneralRe: Getting the Excepption ExceptionType Newtonsoft.Json.JsonSerializationException in my Web API Pin
indian14317-May-17 10:39
indian14317-May-17 10:39 
GeneralRe: Getting the Excepption ExceptionType Newtonsoft.Json.JsonSerializationException in my Web API Pin
Richard Deeming17-May-17 11:23
mveRichard Deeming17-May-17 11:23 
GeneralRe: Getting the Excepption ExceptionType Newtonsoft.Json.JsonSerializationException in my Web API Pin
indian14317-May-17 12:14
indian14317-May-17 12:14 
Questionhow can i add gridview in asp.net page using c# Pin
Joker87AHAHAH10-May-17 7:26
Joker87AHAHAH10-May-17 7:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.