108 109 } 以上代码中的_strServUDaemonPath变量用于保存ServUDaemon.ini文件所在的路径,该值可以在PageLoad事件中通过Web.Config设置取得。 但事情并没有就此结束。经过测试,发现在存在一个严重的问题:修改密码后只有重启Serv-U才能使修改后的密码生效。那不是等于没什么用嘛,管理员总不可能没事老在那里重启服务器来使密码修改生效吧。 再次回来Serv-U的官方知识库,查到了如下一条内容: Manually Updating the ServUDaemon.ini File Whenever changes are made directly to the ServUDaemon.ini file, add the following line under the Global area in the INI file.
ReloadSettings=True
Serv-U regularly checks the INI file for this setting. If it is present, Serv-U will refresh all stored settings for every domain on the server. This allows Serv-U to recognize the changes without having to be restarted.
After Serv-U loads the changes, it removes the "ReloadSettings=True" entry. This allows you to enter it again next time any changes are made. 也就是说,只要在INI文件的GLOBAL节添加键ReloadSettings并设置它的值为True便可以实现修改密码后自动更新了。于是只要修改原代码,在101行和102行之间插入如下一句代码即可: ini.WriteString( "GLOBAL", "ReloadSettings", "True" ); 到这里,一个在线修改Serv-U密码的网页就全部完成了。 程序中的IniFile是一个封装了API对INI文件操作的类,仅需要实现对字符串的读取和写入即可。