button no longer fires - help!

C

Chris K

I have a page on a customer's site - asp.net, c#, hosted on windows 2003.
There's a server-side button on the page which updates a value in a sql
database. This has worked fine for months, but mysteriously stopped working
about 10 days ago. It still works fine in my local dev environment (win xp),
and reposting the code doesn't do any good. I even tried deleting the button
and recreating it. I came up with a work around - using a linkbutton (using
the same codebehind function) to execute the database query. I asked the
hosting provider if they did anything recently to the server, and they claim
they only installed a few updates from windowsupdate.

I just noticed my own web site hosted from them has the same problem with my
contact form. My contact form has a button which uses cdo to send the
results of the form to an email address. This also worked fine up until 10
days ago.

Any ideas??? Has anybody encountered similar problems?? I'm kind of at a
loss at this point... TIA

The c# code for my page (http://www.infomend.com/contactus.aspx) is below if
it helps. Thanks!

- Chris



using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Web.Mail;

namespace infomend
{
public class contactus : System.Web.UI.Page
{
protected System.Web.UI.WebControls.TextBox txtName;
protected System.Web.UI.WebControls.TextBox txtCompany;
protected System.Web.UI.WebControls.TextBox txtPhone;
protected System.Web.UI.WebControls.TextBox txtEmail;
protected System.Web.UI.WebControls.DropDownList ddlTimeframe;
protected System.Web.UI.WebControls.DropDownList ddlBudget;
protected System.Web.UI.WebControls.DropDownList ddlProjectType;
protected System.Web.UI.WebControls.TextBox txtDescription;
protected System.Web.UI.WebControls.RequiredFieldValidator
RequiredFieldValidator1;
protected System.Web.UI.WebControls.RequiredFieldValidator
RequiredFieldValidator2;
protected System.Web.UI.WebControls.RequiredFieldValidator
RequiredFieldValidator3;
protected System.Web.UI.WebControls.TextBox txtBestTime;
protected System.Web.UI.WebControls.LinkButton lnkSubmit;
protected System.Web.UI.WebControls.Label lblResults;

private void Page_Load(object sender, System.EventArgs e)
{
}

#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.lnkSubmit.Click += new System.EventHandler(this.btnSubmit_Click);
this.Load += new System.EventHandler(this.Page_Load);

}
#endregion

private void btnSubmit_Click(object sender, System.EventArgs e)
{
if (Page.IsValid)
{
string body = "";
body += "Name: " + this.txtName.Text + Environment.NewLine;
body += "Company: " + this.txtCompany.Text + Environment.NewLine;
body += "Phone: " + this.txtPhone.Text + Environment.NewLine;
body += "Best time to call: " + this.txtBestTime.Text +
Environment.NewLine;
body += "Email: " + this.txtEmail.Text + Environment.NewLine;
body += "Timeframe: " + this.ddlTimeframe.SelectedItem.Value +
Environment.NewLine;
body += "Budget: " + this.ddlBudget.SelectedItem.Value +
Environment.NewLine;
body += "Project Type: " + this.ddlProjectType.SelectedItem.Value +
Environment.NewLine;
body += "Description: " + this.txtDescription.Text +
Environment.NewLine;
try
{
SendEmail("(e-mail address removed)", "(e-mail address removed)", "Quote
Request",
body, MailFormat.Text);
this.lblResults.Text = "Quote processed. A sales representative will be
contacting you shortly!";
}
catch (Exception mailErr)
{
this.lblResults.Text = "Error processing quote: " +
mailErr.Message.ToString();
}
}
}

public static void SendEmail(string To, string From, string
Subject, string Body, System.Web.Mail.MailFormat Format)
{
System.Web.Mail.MailMessage Mailer = new
System.Web.Mail.MailMessage();
Mailer.From = From;
Mailer.To = To;
Mailer.Subject = Subject;
Mailer.Body = Body;
Mailer.BodyFormat = Format;
System.Web.Mail.SmtpMail.Send(Mailer);
}
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,262
Messages
2,571,052
Members
48,769
Latest member
Clifft

Latest Threads

Top