先说下,我写的很多技术类文章都是面向初学者的,为了便于他们理解,我会写的尽量详细,包括很多最基础的操作步骤,并且有些说法可能不太严谨,高手请勿追究。以前我做网站设置模块的时候,总喜欢把设置都写在一个xml文件里,然后用程序去读写这个xml文件。虽然.NET对XML的支持很好(现在有Linq To XML了),并且我也使用了一个XML工具类,但总体来说,自己手动读写一个xml文件,还是有点蛋疼的。一不小心就容易出错。 今天我突然想到,我们曾经无数次在Web.Config里读取过连接字符串,那么为何不把网站的设置信息也保存在Web.Config中呢?只要使用System.Configuration下的ConfigurationManager类就可以操作Web.Config了,微软都给我们封装好了! 为了验证这一点的可行性,我写
Recently, I saw an exam system that has a feature to monitor the process. As soon as prohibited software such as Communicator.exe is found, the process is immediately killed and reported to the server. I looked into it a little bit, and this feature is actually quite simple to implement. It is to use ManagementObjectSearcher to get a list of processes, then put them in a Collection, and then you can do it according to your own logic. Here's an example: get a list of processes, create a list of "banned" processes, find and kill processes. Note that you need to add a reference to System.Management in your project first.