Groupon.com Clone – Ask For Quote

Groupon has taken the Internet world by storm. Why not? The concept is very simple, each day all the subscribers are emailed a single fantastic deal. It could be deep discounts on food, entertainment, places to stay or things to buy. Since Groupon.Com launched, it has been featured on just about every major media channel …

Read More

Avoiding “Cross-thread operation not valid” Exception With Multithreaded Applications

Unfortunately, enabling thread synchronization for controls is a very hard problem to solve–and even the most elegant solutions have considerable drawbacks. I have tried to develop a demo application in C# that avoids this exception. public partial class Form1 : Form { Thread demothread, demothread1; public delegate void SetTextCallback(string s); public Form1() { InitializeComponent(); } …

Read More

FTP fileupload using C Sharp NET

Here is the simple class file using which you can upload a file to the FTP using .NET class library. This class implements an FTP client. class Upload { public static string uploadFile(string FTPAddress, string filePath, string FTPDir, string username, string password) { try { //Create FTP request FtpWebRequest request = (FtpWebRequest)FtpWebRequest.Create(FTPAddress + “/” + …

Read More

Sending emails using .NET

You can use the below class to send the emails using asp.net form or any windows based .net applications. This implements the SMTP client to send email. public class MyOwnSMTP { public void SendMail(string From, string To, string Sub, string Body) { MailMessage Email = new MailMessage(From, To, Sub, Body); Email.IsBodyHtml = true; SmtpClient smtp …

Read More

Sending email using gmail SMTP server using .NET

If you do not have an SMTP server of your own, you can still send SMTP authenticated emails from your .net application. Just sign up for a brand new gmail account or use your exisiting gmail account. SmtpClient obj = new SmtpClient(“smtp.gmail.com”,465); //465 is the TCP port for sending emails using gmail. 465 is generally …

Read More

Creating PDF using .NET itextsharp component VB.NET

To create a PDF file from any .net application is very easy. You just need to use itextsharp component. You can download this component http://itextsharp.sourceforge.net Just import this component namespace to your application. Here is the sample code. Dim doc as New Document PdfWriter.GetInstance(doc,New FileStream(“Sample.pdf”,FileMode.Create)) doc.Open() doc.Add(New Paragraph(” Add the contects”,FontFactory.GetFont(FontFactory.TIMES ROMAN,22,iTextSharp.text.Font.BOLD))) doc.close()

Read More

Creating mutually exclusive code block C#

Sometimes, we may need to act on some information(object) which is critical for the application and we need to make sure that the information contained by that object is consistent. The way to keep the information in the object consistent is to avoid the access of that object by more than one thread or program. …

Read More

Fetching URL contents into a string using HttpWebRequest

You can use the below class for fetching the contents of any HTTP URL using the HTTP GET method. This makes use the webrequest classes of .NET class library. public static class GetUrl { public static string FetchURL(string url) { const int bufSizeMax = 65536; // max read buffer size conserves memory const int bufSizeMin …

Read More

Changing the IP address of the server using asp net

Changing the IP address of the computer automatically is very easy. Microsoft trickily stores the IP information in registry. Refer the below code that changes the IP address of the host server. This can be used in windows application or windows services to change the IP address of the local computer and can also be …

Read More

add/update windows users – windows user management

Sometimes, we may need to add/update the windows user management functionality in our windows application or windows service. In such cases, we can just use the ‘net user’ functionality of the windows operating system. Refer the below command to perform user operations. NET USER [username [password | *] [options]] [/ username {password | *} /ADD …

Read More
Page 1 of 212»