Regular expression For validating file types
HI,
Friends This Information might be very small but very usefull. This is regarding to validating file types when uploading through fileupload control in asp.net.
The Expresssion is as follows
^.*\.(exe|bat|etc)$
Just Copy the above Expression And paste it in regular expression property of Regular Expression validator control. You can add as many as etensions you like.
Happy Coding.
Source Code For mailing in asp.net C#
Hello,
Friends I was looking at a source code which helps me to send mail from my asp.net web applications finally i got this coding which works fine.
Note: Tested On Godaddy Server, IXwebshoting
And dont forget to use namespace
using System.Net.Mail;
public void mail2()
{
try
{
MailMessage msg = new MailMessage();
msg.From = new MailAddress("support@fornamboothiri.com ", "aaa.com");
msg.To.Add("cool.xxxxx@gmail.com ");
msg.Subject = "aaa.com";
msg.Body = "Greetings from aaa.com!
Thank you for registering in fornamboothiri’s matrimony. We wish you success in your partner search. We hope you make the best use of the facilities available on this site – partner search, horoscope matching and other services; all of which comes absolutely free!!
We also advice you to update the profile as and when required.
This registration is valid for 3 months. Thereupon an email will be sent asking you to either activate or delete the profile. This is only to avoid unnecessary enquiries of profiles once the marriages are already settled.
Your member name";
Thank you for registering in fornamboothiri’s matrimony. We wish you success in your partner search. We hope you make the best use of the facilities available on this site – partner search, horoscope matching and other services; all of which comes absolutely free!!
We also advice you to update the profile as and when required.
This registration is valid for 3 months. Thereupon an email will be sent asking you to either activate or delete the profile. This is only to avoid unnecessary enquiries of profiles once the marriages are already settled.
Your member name";
msg.IsBodyHtml = true;
// MailMessage instance to a specified SMTP server
SmtpClient smtp = new SmtpClient("relay-hosting.secureserver.net ", 25);
smtp.Credentials = new System.Net.NetworkCredential("support@XXXXX.com ", "XXXXXX");
smtp.Port = 25;
// Sending the email
smtp.Send(msg);
Response.Write("Mail Sent");
// destroy the message after sent
msg.Dispose();
}
catch (Exception ex)
{
Response.Write(ex);
}
}
Happy Coding