0

hello !
i am working on a simple application that can block the sites ,after searching i found that if i add name of the site in c:\windows\system32\drivers\etc\hosts then i can block those sites , for this i want to open this hosts file in my textbox with administrator rights , so that it can save changes. how i can do this ? do i have to run my application with administrator rights or i can just open hosts file in my textbox with administrator rights ?

regards

3
Contributors
5
Replies
7
Views
5 Years
Discussion Span
Last Post by M.Waqas Aslam
0

Using IO read the file in memory.. And add the line to text file using IO.File.Write and save the file..

0

If you start Notepad as administrator and open the host-file you can edit and save it. No application needed.

0

thanks both of you for your help . i just run my application as administrator and just make changes in my file ,

Regards

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.