Pages

Friday, June 17, 2011

IIS unexpected error 0x8ffe2740

buka cmd
run netstat -a -o -n





cari local address dengan Port 80 , cari PID
lalu pada task manager,
pilih tab Processes, lalu pilih View >> Select Columns >> Check PID
Cari proses dengan PID yg terdapat pada command prompt
Klik kanan, End Proses Tree

Wednesday, June 1, 2011

MD5 Hash Encript (C#)

using System.Security.Cryptography;
private string MD5Encrypt(string plaintext)
    {
        ciphertext = "";
        MD5CryptoServiceProvider md5Hasher = new MD5CryptoServiceProvider();
        byte[] data = System.Text.Encoding.ASCII.GetBytes(plaintext);
        data = md5Hasher.ComputeHash(data);
        for (int i = 0; i < data.Length; i++)
        {
            ciphertext += data[i].ToString("x2").ToLower();
        }
        return ciphertext;
}

Kirim Email ASP.NET (C#)

using System.Net.Mail;
using System.Text;
using System.Net;

public bool KirimEmail(List<string> recipients, string sub,string textbody)
{       
        MailMessage mail = new MailMessage();

        foreach (var item in recipients)
        {
            mail.To.Add(item);
        }

        mail.From = new MailAddress("AlamatEmailAnda@Gmail.com");

        mail.Subject = sub;
        //email's body, this is going to be html.
        //note that we attach the image as using cid
        mail.Body = textbody; //<br/> &lt;img src=\ " cid:tmpImage.gif\ " >";
        //set email's body to html
        mail.IsBodyHtml = true;

        //add our attachment
        //Attachment imgAtt = new Attachment(Server.MapPath("tmpImage.gif"));
 //give it a content id that corresponds to the src we added in the body img tag
        //imgAtt.ContentId = "tmpImage.gif";
        //add the attachment to the email
       // mail.Attachments.Add(imgAtt);

        //setup our smtp client, these are Gmail specific settings
        SmtpClient client = new SmtpClient("smtp.gmail.com", 587);
        client.EnableSsl = true; //ssl must be enabled for Gmail
        //our Gmail account credentials
NetworkCredential credentials = new NetworkCredential("AlamatEmailAnda@Gmail.com", "pass");
        //add credentials to our smtp client
        client.Credentials = credentials;

        try
        {
            client.Send(mail);
            return true;
        }
        catch
        {
            return false;
        }
}

ShareThis