I have two querie. (1) I noticed that I was getting MAC viewstate error. I therefore added a machine key entry to my web config. Now I have noticed that the MAC viewstate isn't the problem - rather it's a method call in the below code. Should I continue to have the machine config entry I added? (2) The error is occuring on a method call. IF I comment this out it works, otherwise it fails. Is there anyway I can debug my code that is hosted? Below is a cut down version of the code that is failing in hosting server, but works fine on my local machine. Can you suggest anything I can try? protected void btnSubmit_Click1(object sender, EventArgs e) { DatabaseLayerDataContext db = new DatabaseLayerDataContext(); try { Comment comments = new Comment(); comments.Title = ddlTitle.SelectedValue; comments.FirstName = txtFirstName.Text; comments.LastName = txtLastName.Text; comments.Message = txtMessage.Text; db.Comments.InsertOnSubmit(comments); db.SubmitChanges(); SendEmail.ProcessEmail(comments.Title, comments.FirstName, comments.LastName, comments.Message);//Error only on hosting lblDisplayMessage.Text = "Thank you for your message. We will deal with this as soon as possible."; } catch (Exception err) { lblDisplayMessage.Text = "An error occurred - please try again later. Thank you for your patience."; Console.WriteLine("{0}", err.Message); } } internal static bool ProcessEmail(string title, string firstName, string lastName, string email, string contactNumber, string comments) { bool emailSent = false; string from = "[email protected]"; string subject = "Customer Comments/Query"; //Email Template StringBuilder emailBody = new StringBuilder(); emailBody.Append("<html><body>"); emailBody.Append("<div style='color: #2CBBF3; height: 100px; width: 800px'>"); emailBody.Append("<img src='http://www.afstel.com/images/emailLogo.jpg' />"); emailBody.Append("<p> Customer Query Details Below.</p>"); emailBody.Append("-----------------------------------------------------------------------------------------------------------------------------"); emailBody.Append("<p>"); emailBody.Append("First Name: " + firstName + "<br />"); emailBody.Append("Last Name: " + lastName + "<br />"); emailBody.Append("Comment/Query: " + "<br /><br />" + comments); emailBody.Append("</div>"); emailBody.Append("</body>"); emailBody.Append("</html>"); MailMessage message = new MailMessage(); SmtpClient smtpClient = new SmtpClient(); string sentInfo = String.Empty; try { MailAddress fromAddress = new MailAddress(from); message.From = fromAddress; message.To.Add(email); message.Subject = subject; message.IsBodyHtml = true; message.Body = emailBody.ToString(); SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.gmail.com"; smtp.Port = 587; smtp.Credentials = new System.Net.NetworkCredential("[email protected]", "myPasword"); smtp.EnableSsl = true; smtp.Send(message); } catch (SmtpException smtpError) { throw smtpError; } return emailSent; }