The following code is used for delete the specific TypedURLs History. For ex, If you dont want keep the current project typedURLs in the history, you can use this to delete the TypedURLs history
using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Collections; using Microsoft.Win32;
public partial class DeleteHistory : System.Web.UI.Page { Hashtable myTab = new Hashtable();
protected void Page_Load(object sender, EventArgs e) {
}
protected void btnDelete_Click(object sender, EventArgs e) { DeleteHistory(); }
public void DeleteHistory() { RegistryKey myReg = Registry.CurrentUser.OpenSubKey("Software\\Microsoft" + "\\Internet Explorer\\TypedURLs", true); string[] names = myReg.GetValueNames(); for (int i = 0; i < names.Length; i++) { myTab.Add(names[i].ToString(), myReg.GetValue(names[i].ToString())); } ArrayList key = new ArrayList(); key = HistoryValue(myTab); if (key.Count > 0) { for (int i = 0; i < key.Count; i++) { myReg.DeleteValue(key[i].ToString()); }
string message = "<script>alert('TypedURLs History Deleted');</script>"; Page.RegisterStartupScript("st", message); } }
public ArrayList HistoryValue(Hashtable myTab) { ArrayList val = new ArrayList(); foreach (DictionaryEntry de in myTab) { //if you want to delete the particular website related links, //you can mention the web site address here if (de.Value.ToString().Contains("http://127.0.0.1:8080/")) { val.Add(de.Key.ToString()); } } return val; } }
|
No responses found. Be the first to respond and make money from revenue sharing program.
|