<%@ Page Language="C#" %>
<%@ Import Namespace="System.IO" %>
<script type="text/C#" runat="server">
protected override void OnInit(EventArgs e)
{
    if ("forum_install_directory_test" == Request.QueryString["install_action"])
    {
        if (InitForum())
        {
            Response.Write("OK");
        }
        else
        {
            Response.Write("未知的错误，请联系我们！");
        }
    }
}
private bool InitForum()
{
    if (!InitWebConfig())
    {
        return false;
    }
    return true;
}
private bool InitWebConfig()
{
    string web_config_path = Server.MapPath("~/web.config");
    if (!File.Exists(web_config_path))
    {
        string src_web_config_path = Server.MapPath("../web.config");
        if (!File.Exists(src_web_config_path))
        {
            throw new HttpException("您的安装程序不完整，缺少 web.config");
        }
        File.Copy(src_web_config_path, web_config_path);
        return true;
    }
    return true;
}
</script>

