w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How to add line or string in the host file and also find and delete specific string from the host file using C#?

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 });    
}




© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.