Monday, January 11, 2010

Email Function In asp.net

using System.Web.Mail;
namespace EmailApplication
{
///
/// Summary description for _Default.
///

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, System.EventArgs e)
{
if(!Page.IsPostBack)
{
}
}
#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);
}
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///

private void InitializeComponent()
{
}
#endregion
// button used to send the email
protected void Button1_Click(object sender, System.EventArgs e)
{
MailMessage mail = new MailMessage();
mail.To = txtTo.Text;
mail.From = txtFrom.Text;
mail.Subject = txtSubject.Text;
mail.Body = txtBody.Text;
MailAttachment attachment=null;
try
{
// check to see if there are any attachments or not
if(FileList.Items.Count > 0)
{
foreach(ListItem l in FileList.Items)
{
// Attaches a new attachment contained in the List
Response.Write(l.Text);
attachment = new MailAttachment(l.Text);
mail.Attachments.Add(attachment);
}
}
//mail.Attachments.Add(attachment);
Response.Write("Number of attachments are"+mail.Attachments.Count);
SmtpMail.SmtpServer = "google.com";
//SmtpMail.SmtpServer = "192.168.232.2";
SmtpMail.Send(mail);
}
catch(Exception ex)
{
Response.Write(ex.Message);
// Cacthes the exception here
}
}
// Button used to attach a file
protected void Button2_Click(object sender, System.EventArgs e)
{
// gets the file name with the whole path
string attachedFile = File1.PostedFile.FileName;
// Adds the item in the list of attached files
if(attachedFile != "")
{
FileList.Items.Add(attachedFile);
}
}
}
}

Tuesday, January 5, 2010

what is c#


C# (pronounced "see sharp") is a multi-paradigm programming language encompassing imperative, functional, generic, object-oriented (class-based), and component-oriented programming disciplines. It was developed by Microsoft within the .NET initiative and later approved as a standard by Ecma (ECMA-334) and ISO (ISO/IEC 23270). C# is one of the programming languages designed for the Common Language Infrastructure.
C# is intended to be a simple, modern, general-purpose, object-oriented programming language.[3] Its development team is led by Anders Hejlsberg, the designer of Borland's Turbo Pascal, who has said that its object-oriented syntax is based on C++ and other languages.[4] James Gosling, who created the Java programming language in 1994, called it an 'imitation' of that language.[5] The most recent version is C# 3.0, which was released in conjunction with the .NET Framework 3.5 in 2007. The next proposed version, 4.0, is in development.

what is java


Java is object oriented language that support all the object oriented feature.
Java is also Platform independed language tht run on any platform like window,linux,unix etc.....

Java is also support multithreading concept that is not supported by any previous object oriented language like c++.