protected void Page_Load(object sender, EventArgs e) { Aceoffix.Xafnetrt.Server rtServer; rtServer = new Aceoffix.Xafnetrt.Server(); string strOutPut = "Welcome to use Aceoffix product.\r\n"; String strRegInfo = ""; if (rtServer.SerialNumber != "") { strRegInfo = "LicenseKey: " + rtServer.SerialNumber + "<br>" + "Version: " + rtServer.VersionInfo + "<br>" + "User: "******"") { strRegInfo = strRegInfo + "<br>" + "This product is a <span style=\"color:Red;\">trial edition</span> and it will expire on " + rtServer.TrialEndTime + "."; } strRegInfo = strRegInfo + "<br>Aceoffix Server Version: " + rtServer.ServerVersion; } else { strRegInfo = "<span style=\"color:Red;\">The product is not registered.</span>"; } strOutPut = strOutPut + "Aceoffix registration information: " + strRegInfo + "\r\n"; strOutPut = strOutPut + "Aceoffix running information: " + rtServer.GetSysLog() + "\r\n"; string ServerIP = Request.ServerVariables["HTTP_HOST"].ToLower(); if ((ServerIP.StartsWith("localhost")) || (ServerIP.StartsWith("127.0.0.1"))) { LabelReg.Text = strRegInfo; LabelLog.Text = rtServer.GetSysLog(); } else { try { FileStream fs = new FileStream(Path.GetTempPath() + "aceserver_log.txt", FileMode.Create);//D:\...\aceoffix-runtime No last "\" StreamWriter sw = new StreamWriter(fs); sw.Write(strOutPut); sw.Flush(); sw.Close(); fs.Close(); LabelReg.Text = "Aceoffix system information has been generated, please view the aceserver_log.txt file in the temp folder of your web server." + "<br>Aceoffix Server Version: " + rtServer.ServerVersion; LabelLog.Text = rtServer.GetSysLog(); //string tempFile = Path.GetTempPath();//If you cannot find the location of temp folder, please remove the comments. //Response.Write(tempFile); } catch { LabelReg.Text = "Cannot make the aceserver_log.txt file. The temp folder's permission maybe insufficient. For security reasons, you can view the system information of Aceoffix only with a local access." + "<br>Aceoffix Server Version: " + rtServer.ServerVersion; LabelLog.Text = rtServer.GetSysLog(); } } }
protected void Page_Load(object sender, EventArgs e) { string strFilePath = Request.QueryString["FilePath"]; string strContentType = Request.QueryString["ContentType"]; string strFileName = Request.QueryString["FileName"]; if (((strFilePath != null) && (strFilePath.Length > 0)) && ((strContentType != null) && (strContentType.Length > 0)) && ((strFileName != null) && (strFileName.Length > 0))) { Response.ContentType = strContentType; Response.AddHeader("Content-Disposition", "attachment; filename=" + strFileName); strFilePath = Server.MapPath(strFilePath); if (!File.Exists(strFilePath)) { throw new Exception("The file \"" + strFilePath + "\" is missing."); } FileStream fs = new FileStream(strFilePath, FileMode.Open, FileAccess.Read); int iLen = (int)fs.Length; byte[] b = new byte[iLen]; fs.Read(b, 0, iLen); fs.Close(); Response.Clear(); Response.OutputStream.Write(b, 0, iLen); Response.End(); return; } Aceoffix.Xafnetrt.Server rtServer; try { rtServer = new Aceoffix.Xafnetrt.Server(); } catch { LabelReg.Text = "<span style=\"color:Red;\">You must install Aceoffix (setup-server.exe) on the web server before use it.</span>"; return; } //For security reasons, you can view the system information of Aceoffix only with a local access. string ServerIP = Request.ServerVariables["HTTP_HOST"].ToLower(); if ((ServerIP.StartsWith("localhost")) || (ServerIP.StartsWith("127.0.0.1"))) { if (rtServer.SerialNumber != "") { LabelReg.Text = "LicenseKey: " + rtServer.SerialNumber + "<br>" + "Version: " + rtServer.VersionInfo + "<br>" + "User: "******"") { LabelReg.Text = LabelReg.Text + "<br>" + "This product is a <span style=\"color:Red;\">trial edition</span> and it will expire on " + rtServer.TrialEndTime + "."; } } else { LabelReg.Text = "<span style=\"color:Red;\">The product is not registered.</span>"; } LabelLog.Text = rtServer.GetSysLog(); } else { Response.Write("For security reasons, you can view the system information of Aceoffix only with a local access."); Response.End(); } }