I created a website and uploading into my hosting server. In that sending mail along with attachment on my hosting server. but i getting following error;
This configuration section cannot be used at this
path. This happens when the site administrator has locked access to this
section using <location allowOverride="false"> from an inherited
configuration file.
Am using VS 2008, asp.net 2.0 and sending mail using System.net.mail name space. here my code:
MailMessage objEmail = new
MailMessage();
objEmail.To.Add(txtTo.Text.ToString());
objEmail.Subject = "User
Account Details";
objEmail.Body = "Your User
Account was created";
objEmail.Priority = System.Net.Mail.MailPriority.High;
objEmail.IsBodyHtml = true;
string
strFileName = null;
if
(FileUpload1.PostedFile != null)
{
HttpPostedFile attFile = FileUpload1.PostedFile;
int
attachFileLength = attFile.ContentLength;
if
(attachFileLength > 0)
{
strFileName =
FileUpload1.PostedFile.FileName;
Attachment attFilename = new Attachment(strFileName);
objEmail.Attachments.Add(attFilename);
}
}
SmtpClient smtpclient = new
SmtpClient();
try
{
smtpclient.Send(objEmail);
Response.Write("successfully
sent");
}
catch
(Exception
ex)
{
Response.Write("send
failure:" + ex.ToString());
}