A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond – Connecting to Gmail with .NET

I’ve been trying to setup a web form to send mail using my google account, but I have repeatedly had no luck. I’ve found many posts about people who are having the same problems, but have yet to come across a viable solution. Here is the code, if you see something that is incorrect, please let me (and others) know how to fix it.

System.Net.Mail.MailMessage mail = new MailMessage();
mail.From = new MailAddress("no-reply@mydomain.com", "Do Not Reply");
mail.To.Add(new MailAddress("email@mydomain.com", "My Email"));
mail.Subject = "Email Subject";
mail.Body = message;
mail.IsBodyHtml = true;
mail.Priority = MailPriority.High;
SmtpClient client = new SmtpClient();
client.EnableSsl = true;
client.Port = 587;
client.Host = "smtp.google.com";
client.UseDefaultCredentials = false;
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.Credentials = new System.Net.NetworkCredential("no-reply@mydomain.com", "password");

Unknown server tag ‘asp:ListView’ – Windows Server 2008

We recently upgraded a server to Windows Server 2008, and some of our old applications decided that they no longer want to work. We are now having problems with the asp:ListView object, constantly getting the error Unknown server tag ‘asp:ListView’.

I’ve found a few articles (quite a few) that all point to the web.config file, saying that you need to add these lines:

  <add assembly="System.Web.Extensions, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

    <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

The best (and only) solution for the problem Unknown server tag ‘asp:ListView’ on Windows Server 2008 is to completely uninstal the .NET Framework 3.5 and the .NET Framework 3.5 SP1. Download them from Microsoft – Do not install them through the Server Roles feature in Windows Server 2008 – and reinstall them from the installation packages.

Hope this helps!