Q:

How to add line or string in the host file and also find and delete specific string from the host file using C#?

I wanna make a application which is used to be block websites which I want and also wanna unblock existing blocked site using this application.
Suppose, I have already blocked www.google.com. Now I have to need unblock www.google.com.
How could I do that exactly?
I am able to block website using C# application but I cannot unblocked the blocked sites. 
Please help me to do this..if u can. 
Code:
private void unblockButton_Click(object sender, EventArgs e)     
{

    string text = File.ReadAllText(path);

    text.Replace("127.0.0.1 www.google.com", string.Empty);

    File.WriteAllLines(path, new[] { text });    
}

A:

String.Replace return new String. Try this.
private void unblockButton_Click(object sender, EventArgs e)     
{

    string text = File.ReadAllText(path);

    text = text.Replace("127.0.0.1 www.google.com", string.Empty);

    File.WriteAllLines(path, new[] { text });    
}

