Monday, June 16, 2008
Few Interesting Dot Net Articles
http://www.alphasierrapapa.com/IisDev/Articles/AspNet.asp
Sunday, June 15, 2008
Tutorial : Sending E-mail using ASP.net through Gmail account (Gmail SMTP Server account)
If you have taken web space somewhere on a web server then you are provided with the Email accounts and SMTP and POP services for sending and receiving E-mails. Some times you don't have SMTP server accounts and you may want to send email. Or Sometimes, for other reasons also you may want to use third-party SMTP sever for sending E-mails .
Gmail is a good solution for this purpose. Gmail provides SMTP and POP access which can be utilized for sending and receiving E-mails.
Here in this tutorial we will be using a Gmail account for sending email by SMTP.
Note:
1. Gmail has a fixed number of quota for sending emails per day, means you may not be able to send unlimited number of e-mails using Gmail due to anti-spamming restrictions.
2. You may not be able to send same e-mail to unlimited number of people, because Gmail's anti-spamming engine restricts for this too.
So, Gmail can be used for sending limited number of e-mails daily to select people only. If you still need to send numerous e-mails to numerous people you can register for a Google Group account and can use that e-mail address to send email to registered members of that group. I will come up with that tutorial in near future.
Requirements:
1. An active Gmail account is required to test this application.
2. Visual Studio 2005
Here we go:
Step 1: Create a new web application in visual studio and add a Web form to it.
Next add a Button to the form and double click this button to bring the code for click event of this button in the code window. Copy paste the following code to the click event.
Note: Don't forget to replace the To and From fields as well as the correct password for successfully sending the mail.
------------------------------------------------------------------------------------------
string from = me@gmail.com; //Replace this with your own correct Gmail Address
string to = you@gmail.com //Replace this with the Email Address to whom you want to send the mail
System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage();
mail.Subject = "This is a test mail" ;
mail.SubjectEncoding = System.Text.Encoding.UTF8;
mail.Body = "This is Email Body Text";
mail.BodyEncoding = System.Text.Encoding.UTF8;
mail.IsBodyHtml = true ;
mail.Priority = MailPriority.High;
SmtpClient client = new SmtpClient();
//Add the Creddentials- use your own email id and password
client.Port = 587; // Gmail works on this port
client.EnableSsl = true; //Gmail works on Server Secured Layer
try {
}
catch (Exception ex)
{
Exception ex2 = ex;
string errorMessage = string.Empty;
while (ex2 != null)
{
errorMessage += ex2.ToString();
ex2 = ex2.InnerException;
}
} // end try
------------------------------------------------------------
Step 2: Run the web application and click on the Button to send the mail. Check the E-mail whether you get the mail successfully or not.
Some-times it takes 2-3 minutes or more to reach the mail to the destination server. So check after a while, if you do not get it soon.
-------------------------
Get back to me if you are not able to execute the application. I will be happy to help you out.
Java Pattern and Practices
I have been fond of Java programing though my productivity centralizes on Dot Net Platform.
Here I found many of the patterns and practices documented / listed at a single place.
It can be a good repository for learners :
http://mindprod.com/
http://mindprod.com/jgloss/designpatterns.html
How to get all the (nested ) Inner Exceptions in the chain
try
{
// the target code that might raise exceptions
}
catch (Exception ex)
{
Exception ex2 = ex;
string errorMessage = string.Empty;
while (ex2 != null)
{
errorMessage += ex2.ToString();
ex2 = ex2.InnerException;
}
// output or save the full error message based on your case
//Response.Write (errorMessage); //or
// Console.WriteLine(errorMessage);
}
Friday, June 13, 2008
LINQ to SQL Samples- Must Read
Useful for the beginners willing to learn LING.
http://msdn.microsoft.com/en-us/vbasic/bb688085.aspx
LINQ is Languages Integrated Query that has been ported with Dot Net Framework 3+ and is a part of Visual Studio 2008.
Here is an another introductory article from about.com on LINQ and XML
http://visualbasic.about.com/od/learnvbnet/a/LVBE_L6.htm?nl=1
String Formating
I have fond many useful reference out there on the web. I am sharing some of them here and will be updating this same post when I find any useful reference for this same topic.
Best place on MSDN for learning about String Formating
http://msdn.microsoft.com/en-us/library/aa720089(VS.71).aspx
Standard Numeric Format Strings
http://msdn.microsoft.com/en-us/library/aa720653.aspx
NET Format String 101
http://blogs.msdn.com/kathykam/archive/2006/03/29/564426.aspx
Good String Handling Description and reference blog:
http://blog.stevex.net/index.php/string-formatting-in-csharp/
Some Hacking / Anti hacking tools
http://www.foundstone.com/us/resources-free-tools.asp
Thursday, June 12, 2008
Banglore - 2nd place in IT arena
As per the latest global tech spot list of Silicon.com, Bangalore is only next to Silicon Valley.
http://www.silicon.com/research/specialreports/techhotspots/ lists the top 20 global hot spots
- Silicon Valley
- Bangalore
- London
- Tokyo
- Boston
- Cambridge
- Shanghai
- Tel Aviv
- Seoul
- Beijing
- Chennai
- Pune
- Singapore
- Helsinki
- Moscow
- Hong Kong
- Hyderabad
- New York
- Sydney
- Shenzhen
India & China have 4 each; US has 3 and UK has 2; while Australia, Finland, Israel, Japan, Korea, Russia and Singapore have 1 each.
Interestingly America has 3, Europe has 4, Middle East has 1, Australia has 1 while Asia has 11!
Blogs I read
Wednesday, June 11, 2008
Creating a HTML editor in ASP.net
here is a working and tested solution at Code Project.