public static string Save(XmlDocument xmlDoc, string filename) { try { SageFrame.Application.Application app = new SageFrame.Application.Application(); string strFilePath = app.ApplicationMapPath + "\\" + filename; FileAttributes objFileAttributes = FileAttributes.Normal; if (File.Exists(strFilePath)) { // save current file attributes objFileAttributes = File.GetAttributes(strFilePath); // change to normal ( in case it is flagged as read-only ) File.SetAttributes(strFilePath, FileAttributes.Normal); } // save the config file XmlTextWriter writer = new XmlTextWriter(strFilePath, null); writer.Formatting = Formatting.Indented; xmlDoc.WriteTo(writer); writer.Flush(); writer.Close(); // reset file attributes File.SetAttributes(strFilePath, objFileAttributes); return(""); } catch (Exception exc) { // the file permissions may not be set properly return(exc.Message); } }
public static void BackupConnStringConfig() { string backupFolder = SystemSetting.glbConnStringConfigFolder + "BackupConnString_" + DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + "\\"; //save the current config files try { SageFrame.Application.Application app = new SageFrame.Application.Application(); if (!Directory.Exists(app.ApplicationMapPath + backupFolder)) { Directory.CreateDirectory(app.ApplicationMapPath + backupFolder); } if (File.Exists(app.ApplicationMapPath + "\\connectionstring.config")) { File.Copy(app.ApplicationMapPath + "\\connectionstring.config", app.ApplicationMapPath + backupFolder + "connectionstring_old.config", true); } } catch (Exception ex) { //Error backing up old web.config //This error is not critical, so can be ignored throw ex; } }
private void BindLabelText() { SageFrame.Application.Application app = new SageFrame.Application.Application(); //lblChooseDatabase.Text = "Select Database:"; lblServer.Text = "Server"; //lblServerHelp.Text = "Enter the Name or IP Address of the computer where the Database is located."; //lblDataBase.Text = "Database:"; //lblDatabaseHelp.Text = "Enter the Database name"; lblIntegrated.Text = "Integrated Security"; lblIntegratedHelp.Text = "Check if the access to SQL server is in Windows Authentication mode. <br/>Uncheck if the access to the server is in SQL Server Authentication mode where you will need to provide the username and password."; lblUserID.Text = "User ID "; //lblUserHelp.Text = "User ID to access the server"; lblPassword.Text = "Password"; //lblPasswordHelp.Text = "Password to access the server"; //lblNewDatabaseHelp.Text = "Enter the New Database Name"; //lblExistingDatabaseHelp.Text = "Enter the Existing Database Name."; //lblDatabaseNameHelp.Text = "Enter a database name"; //lblOwner.Text = "Run as Owner:"; //lblOwnerHelp.Text = "Check if you are running the database as Database Owner or you will need to provide the User ID."; }
private void BindTopStickybar() { string adminURL = GetParentURL + "/Admin/Admin" + extenstion; SageFrameConfig sfConfig = new SageFrameConfig(); hypLogo.NavigateUrl = adminURL; hypEdit.NavigateUrl = GetHostURL() + "/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + SageFrameSettingKeys.PageExtension; hypLogo.ImageUrl = GetApplicationName + "/Administrator/Templates/Default/images/sageframe.png"; string appPath = GetApplicationName; string LogoPath = Server.MapPath(appPath + "~/Administrator/Templates/Default/images/SageLogo.png"); if (File.Exists(LogoPath)) { hypLogo.NavigateUrl = GetPortalAdminPage(); hypLogo.ImageUrl = appPath + "/Administrator/Templates/Default/images/SageLogo.png"; if (GetUsername != SystemSetting.SYSTEM_USER) { lblHideLogo.Visible = false; } } else { divLogo.Visible = false; } hlnkDashboard.NavigateUrl = adminURL; SageFrame.Application.Application app = new SageFrame.Application.Application(); lblVersion.Text = string.Format("V {0}", app.FormatShortVersion(app.Version, true)); lnkAccount.NavigateUrl = GetParentURL + "/sf/" + "sfUser-Profile" + extenstion; }
private void RestartApplication() { //System.Web.HttpRuntime.UnloadAppDomain(); //Response.Redirect("./"); SageFrame.Application.Application app = new SageFrame.Application.Application(); File.SetLastWriteTime((app.ApplicationMapPath + "\\web.config"), System.DateTime.Now); System.Web.Security.FormsAuthentication.SignOut(); Response.Redirect(Page.ResolveUrl("~/" + CommonHelper.DefaultPage), true); }
private void LoadHeadContent() { try { SageFrameConfig sfConfig = new SageFrameConfig(); string strCPanleHeader = sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalLogoTemplate); litCPanleTitle.Text = strCPanleHeader; SageFrame.Application.Application app = new SageFrame.Application.Application(); litSFVersion.Text = app.Version.ToString(); } catch (Exception ex) { ProcessException(ex); } }
protected void Page_Load(object sender, EventArgs e) { IncludeLanguageJS(); appPath = GetApplicationName; SecurityPolicy objSecurity = new SecurityPolicy(); userName = objSecurity.GetUser(GetPortalID); Extension = SageFrameSettingKeys.PageExtension; if (!IsPostBack) { // BindThemes(); //BindLayouts(); //BindValues(); hlnkDashboard.Visible = false; SageFrameConfig conf = new SageFrameConfig(); string ExistingPortalShowProfileLink = conf.GetSettingValueByIndividualKey(SageFrameSettingKeys.PortalShowProfileLink); lnkAccount.NavigateUrl = GetProfileLink(); if (ExistingPortalShowProfileLink == "1") { lnkAccount.Visible = true; } else { lnkAccount.Visible = false; } SageFrame.Application.Application app = new SageFrame.Application.Application(); lblVersion.Text = string.Format("V {0}", app.FormatShortVersion(app.Version, true)); } hypLogo.NavigateUrl = GetPortalAdminPage(); hypLogo.ImageUrl = appPath + "/Administrator/Templates/Default/images/sagecomers-logoicon.png"; RoleController _role = new RoleController(); string[] roles = _role.GetRoleNames(GetUsername, GetPortalID).ToLower().Split(','); if (roles.Contains(SystemSetting.SUPER_ROLE[0].ToLower()) || roles.Contains(SystemSetting.SITEADMIN.ToLower())) { hlnkDashboard.Visible = true; hlnkDashboard.NavigateUrl = GetPortalAdminPage(); cpanel.Visible = true; AspxAdminNotificationView1.Visible = true; IsAdmin = true; } else { cpanel.Visible = false; } }
protected void Page_Load(object sender, EventArgs e) { appPath = GetApplicationName; Extension = SageFrameSettingKeys.PageExtension; UserName = GetUsername; PortalID = GetPortalID; PortalName = GetPortalSEOName; SageFrameConfig sfConfig = new SageFrameConfig(); bool ShowSideBar = sfConfig.GetSettingBoolValueByIndividualKey(SageFrameSettingKeys.ShowSideBar); IsSideBarVisible = ShowSideBar ? 1 : 0; BuildQuickLinks(); //lblVersion.Text = string.Format("V {0}", Config.GetSetting("SageFrameVersion")); SageFrame.Application.Application app = new SageFrame.Application.Application(); lblVersion.Text = string.Format("V {0}", app.FormatShortVersion(app.Version, true)); }
public static XmlDocument Load(string filename) { SageFrame.Application.Application app = new SageFrame.Application.Application(); // open the config file XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(app.ApplicationMapPath + "\\" + filename); // test for namespace added by Web Admin Tool if (!string.IsNullOrEmpty(xmlDoc.DocumentElement.GetAttribute("xmlns"))) { // remove namespace string strDoc = xmlDoc.InnerXml.Replace("xmlns=\"http://schemas.microsoft.com/.NetConfiguration/v3.0\"", ""); xmlDoc.LoadXml(strDoc); } return(xmlDoc); }
private bool BindPermissions(bool test) { ///Test Strategy 1 bool status = true; try { SageFrame.Application.Application app = new SageFrame.Application.Application(); PermissionsValid = true; //FolderCreate ListItem permissionItem = new ListItem(); if (test) { status = VerifyFolderCreate(); } permissionItem.Selected = status; if (!status) { } permissionItem.Enabled = false; permissionItem.Text = "Create Folder"; //FileCreate permissionItem = new ListItem(); if (test) { status = VerifyFileCreate(); } permissionItem.Selected = status; if (!status) { } permissionItem.Enabled = false; permissionItem.Text = "Create File"; //FileDelete permissionItem = new ListItem(); if (test) { status = VerifyFileDelete(); } permissionItem.Selected = status; if (!status) { } permissionItem.Enabled = false; permissionItem.Text = "Delete File"; //FolderDelete permissionItem = new ListItem(); if (test) { status = VerifyFolderDelete(); } permissionItem.Selected = status; if (!status) { } permissionItem.Enabled = false; permissionItem.Text = "Delete Folder"; } catch { } ///Test Strategy 2 bool checkPermission = true; string rootDir = HttpContext.Current.Server.MapPath("~/"); List <KeyValuePair <string, string> > dirsToCheck = new List <KeyValuePair <string, string> >(); dirsToCheck.Add(new KeyValuePair <string, string>(rootDir, Request.ApplicationPath.ToString())); dirsToCheck.Add(new KeyValuePair <string, string>(rootDir + "Install", "Install")); dirsToCheck.Add(new KeyValuePair <string, string>(rootDir + "XMLMessage", "XMLMessage")); dirsToCheck.Add(new KeyValuePair <string, string>(rootDir + "SiteMap", "SiteMap")); StringBuilder sb = new StringBuilder(); sb.Append("Permission Test Failed For : "); List <string> fileList = new List <string>(); foreach (KeyValuePair <string, string> kvp in dirsToCheck) { if (!CheckPermissions(kvp.Key, false, true, true, true) && checkPermission) { fileList.Add(kvp.Value); } } List <KeyValuePair <string, string> > filesToCheck = new List <KeyValuePair <string, string> >(); filesToCheck.Add(new KeyValuePair <string, string>(rootDir + "web.config", "web.config")); filesToCheck.Add(new KeyValuePair <string, string>(rootDir + "version.config", "version.config")); filesToCheck.Add(new KeyValuePair <string, string>(rootDir + "connectionstring.config", "connectionstring.config")); foreach (KeyValuePair <string, string> kvp in filesToCheck) { if (!CheckPermissions(kvp.Key, false, true, true, true) && checkPermission) { fileList.Add(kvp.Value); PermissionsValid = false; } } if (fileList.Count > 0) { sb.Append(String.Join(",", fileList.ToArray()).ToString()); string strPermissionsError = sb.ToString() + "<br> Your site failed the permissions check. Using Windows Explorer, browse to the root folder of the website ( {0} ). Right-click the folder and select Sharing and Security from the popup menu. Select the Security tab. Add the appropriate User Account and set the Permissions.<h3>If using Windows 2000 - IIS5</h3>The {Server}\\ASPNET User Account must have Read, Write, and Change Control of the virtual root of your website.<h3>If using Windows 2003, Windows Vista or Windows Server 2008 and IIS6 or IIS7</h3>The NT AUTHORITY\\NETWORK SERVICE User Account must have Read, Write, and Change Control of the virtual root of your Website.<h3>If using Windows 7 or Windows Server 2008 R2 and IIS7.5</h3>The IIS AppPool\\DefaultAppPool User Account must have Read, Write, and Change Control of the virtual root of your Website."; lblPermissionsError.Text = strPermissionsError.Replace("{0}", Request.ApplicationPath); lblPermissionsError.CssClass = "sfError"; } else { lblPermissionsError.Text = "Your site passed all the permissions check."; lblPermissionsError.CssClass = "sfSuccess"; PermissionsValid = true; } lblPermissionsError.Visible = true; return(PermissionsValid); }
public static void RestartApplication() { SageFrame.Application.Application app = new SageFrame.Application.Application(); File.SetLastWriteTime(app.ApplicationMapPath + "\\version.config", System.DateTime.Now); }
public static string Save(XmlDocument xmlDoc, string filename) { try { SageFrame.Application.Application app = new SageFrame.Application.Application(); string strFilePath = app.ApplicationMapPath + "\\" + filename; FileAttributes objFileAttributes = FileAttributes.Normal; if (File.Exists(strFilePath)) { // save current file attributes objFileAttributes = File.GetAttributes(strFilePath); // change to normal ( in case it is flagged as read-only ) File.SetAttributes(strFilePath, FileAttributes.Normal); } // save the config file XmlTextWriter writer = new XmlTextWriter(strFilePath, null); writer.Formatting = Formatting.Indented; xmlDoc.WriteTo(writer); writer.Flush(); writer.Close(); // reset file attributes File.SetAttributes(strFilePath, objFileAttributes); return ""; } catch (Exception exc) { // the file permissions may not be set properly return exc.Message; } }
public static XmlDocument Load(string filename) { SageFrame.Application.Application app = new SageFrame.Application.Application(); // open the config file XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(app.ApplicationMapPath + "\\" + filename); // test for namespace added by Web Admin Tool if (!string.IsNullOrEmpty(xmlDoc.DocumentElement.GetAttribute("xmlns"))) { // remove namespace string strDoc = xmlDoc.InnerXml.Replace("xmlns=\"http://schemas.microsoft.com/.NetConfiguration/v3.0\"", ""); xmlDoc.LoadXml(strDoc); } return xmlDoc; }
protected void imbCreatePackage_Click(object sender, ImageClickEventArgs e) { List<FileDetails> selectedFiles = new List<FileDetails>(); List<FileDetails> selectedResxFiles = GetSelectedLanguageFiles(this.ddlResourceLocale.SelectedValue.ToString(), selectedFiles, "~/Modules", "*.resx"); selectedResxFiles = GetSelectedLanguageFiles(this.ddlResourceLocale.SelectedValue.ToString(), selectedResxFiles, "~/XMLMessage", "*.xml"); selectedResxFiles = GetSelectedLanguageFiles(this.ddlResourceLocale.SelectedValue.ToString(), selectedResxFiles, "~/Modules", "*.xml"); string filepath = Server.MapPath("~/Install/Language"); if (!Directory.Exists(filepath)) { Directory.CreateDirectory(filepath); } ///Get the application version SageFrame.Application.Application app = new SageFrame.Application.Application(); app.FormatVersion(app.Version, true); StringBuilder fileNameSB = new StringBuilder(); fileNameSB.Append("ResourcePack."); fileNameSB.Append(txtResourcePackName.Text); fileNameSB.Append("."); fileNameSB.Append(app.Version.ToString()); fileNameSB.Append("."); fileNameSB.Append(ddlResourceLocale.SelectedValue.ToString()); string fileName = fileNameSB.ToString(); List<FileDetails> newFileList = new List<FileDetails>(); switch (rbResourcePackType.SelectedIndex) { case 0: newFileList = GetCoreModuleResources(selectedResxFiles); ; break; case 1: GetSelectedModules(ref newFileList,selectedResxFiles); break; case 2: newFileList = selectedResxFiles; break; } try { PackageWriterBase.WriteManifest(filepath, "manifest", newFileList, GetPackageInfo()); PackageWriterBase.WriteZipFile(newFileList, filepath + @"/" + fileName + ".zip", filepath + @"\manifest.sfe", "manifest.sfe"); ViewState["FilePath"]=filepath + @"/" + fileName + ".zip"; this.lnkBtnDownloadPackage.Text = fileName + ".zip"; this.lblDownLoadPathLabel.Visible = true; ShowMessage(SageMessageTitle.Information.ToString(), GetSageMessage("LanguageModule", "PackageCreatedSuccessfully"), "", SageMessageType.Success); if(rbResourcePackType.SelectedIndex==1) { divModuleDetails.Visible = true; } } catch (Exception ex) { ProcessException(ex); } }
protected void imbCreatePackage_Click(object sender, ImageClickEventArgs e) { string FullFilePath = ""; List<FileDetails> selectedFiles = new List<FileDetails>(); List<FileDetails> selectedResxFiles = GetSelectedLanguageFiles(this.ddlResourceLocale.SelectedValue.ToString(), selectedFiles, "~/Modules", "*.resx"); selectedResxFiles = GetSelectedLanguageFiles(this.ddlResourceLocale.SelectedValue.ToString(), selectedResxFiles, "~/Modules", "*.js"); selectedResxFiles = GetSelectedLanguageFiles(this.ddlResourceLocale.SelectedValue.ToString(), selectedResxFiles, "~/XMLMessage", "*.xml"); selectedResxFiles = GetSelectedLanguageFiles(this.ddlResourceLocale.SelectedValue.ToString(), selectedResxFiles, "~/Modules", "*.xml"); string filepath = Server.MapPath("~/Install/Language"); if (!Directory.Exists(filepath)) { Directory.CreateDirectory(filepath); } ///Get the application version SageFrame.Application.Application app = new SageFrame.Application.Application(); app.FormatVersion(app.Version, true); StringBuilder fileNameSB = new StringBuilder(); fileNameSB.Append("ResourcePack."); fileNameSB.Append(txtResourcePackName.Text); fileNameSB.Append("."); fileNameSB.Append(app.Version.ToString()); fileNameSB.Append("."); fileNameSB.Append(ddlResourceLocale.SelectedValue.ToString()); string fileName = fileNameSB.ToString(); List<FileDetails> newFileList = new List<FileDetails>(); switch (rbResourcePackType.SelectedIndex) { case 0: newFileList = GetCoreModuleResources(selectedResxFiles); ; break; case 1: GetSelectedModules(ref newFileList, selectedResxFiles); break; case 2: newFileList = selectedResxFiles; break; } try { PackageWriterBase.WriteManifest(filepath, "manifest", newFileList, GetPackageInfo()); PackageWriterBase.WriteZipFile(newFileList, filepath + @"/" + fileName + ".zip", filepath + @"\manifest.sfe", "manifest.sfe"); FullFilePath = string.Format("{0}/{1}.zip", filepath, fileName); ViewState["FilePath"] = FullFilePath; if (File.Exists(FullFilePath)) { Response.ClearContent(); Response.AppendHeader("Content-Disposition", "attachment; filename=" + fileName + ".zip"); Response.ContentType = "application/octet-stream"; using (Stream input = File.OpenRead(FullFilePath)) { byte[] buffer = new byte[4096]; int count = input.Read(buffer, 0, buffer.Length); while (count > 0) { Response.OutputStream.Write(buffer, 0, count); count = input.Read(buffer, 0, buffer.Length); } } ShowMessage("", GetSageMessage("LanguageModule", "PackageCreatedSuccessfully"), "", SageMessageType.Success); File.Delete(FullFilePath); } if (rbResourcePackType.SelectedIndex == 1) { divModuleDetails.Visible = true; } } catch (Exception ex) { ProcessException(ex); } finally { Response.End(); } }
//private void AddAttributes() //{ // txtHostingFee.Attributes.Add("OnKeydown", "return NumberKeyWithDecimal(event)"); // txtHostingSpace.Attributes.Add("OnKeydown", "return NumberKeyWithDecimal(event)"); // txtPageQuota.Attributes.Add("OnKeydown", "return NumberKeyWithDecimal(event)"); // txtUserQuota.Attributes.Add("OnKeydown", "return NumberKey(event)"); // txtDemoPeriod.Attributes.Add("OnKeydown", "return NumberKey(event)"); // txtWebRequestTimeOut.Attributes.Add("OnKeydown", "return NumberKey(event)"); //} private void BindData() { SageFrame.Application.Application app = new SageFrame.Application.Application(); SageFrameConfig pagebase = new SageFrameConfig(); lblVProduct.Text = app.Description; lblVVersion.Text = app.FormatVersion(app.Version, true); //imbIsUpgradeAvilable.ImageUrl = GetTemplateImageUrl("imgupgrade.png", true); lblVDataProvider.Text = app.DataProvider; lblVDotNetFrameWork.Text = app.NETFrameworkIISVersion.ToString(); lblVASPDotNetIdentiy.Text = System.Security.Principal.WindowsIdentity.GetCurrent().Name; lblVServerName.Text = app.DNSName; lblVIpAddress.Text = app.ServerIPAddress; lblVPermissions.Text = Framework.SecurityPolicy.Permissions; lblVRelativePath.Text = app.ApplicationPath; lblVPhysicalPath.Text = app.ApplicationMapPath; lblVServerTime.Text = DateTime.Now.ToString(); lblVGUID.Text = pagebase.GetSettingsByKey(SageFrameSettingKeys.GUID); //ServerController svc = new ServerController(); //chkIsWebFarm.Checked = svc.IsWebFarm; BinSitePortal(); if (ddlHostPortal.Items.Count > 0) { ddlHostPortal.SelectedIndex = ddlHostPortal.Items.IndexOf(ddlHostPortal.Items.FindByValue(SageFrameSettingKeys.SuperUserPortalId)); } txtHostTitle.Text = pagebase.GetSettingsByKey(SageFrameSettingKeys.SuperUserTitle); txtHostUrl.Text = pagebase.GetSettingsByKey(SageFrameSettingKeys.SuperUserURL); txtHostEmail.Text = pagebase.GetSettingsByKey(SageFrameSettingKeys.SuperUserEmail); //Apprence chkCopyright.Checked = pagebase.GetSettingBollByKey(SageFrameSettingKeys.SuperUserCopyright); chkUseCustomErrorMessages.Checked = pagebase.GetSettingBollByKey(SageFrameSettingKeys.UseCustomErrorMessages); BinSiteTemplates(); if (ddlTemplate.Items.Count > 0) { string Template = pagebase.GetSettingsByKey(SageFrameSettingKeys.SageFrameCSS); ddlTemplate.SelectedIndex = ddlTemplate.Items.IndexOf(ddlTemplate.Items.FindByText(Template)); } ////Payment //BindPaymentProcessor(); //if (ddlPaymentProcessor.Items.Count > 0) //{ // string ExistsPaymentProcessor = pagebase.GetSettingsByKey(SageFrameSettingKeys.PaymentProcessor); // ddlPaymentProcessor.SelectedIndex = ddlPaymentProcessor.Items.IndexOf(ddlPaymentProcessor.Items.FindByText(ExistsPaymentProcessor)); //} //txtPaymentProcessorUserID.Text = pagebase.GetSettingsByKey(SageFrameSettingKeys.ProcessorUserId); //txtPaymentProcessorPassword.Text = pagebase.GetSettingsByKey(SageFrameSettingKeys.ProcessorPassword); //txtHostingFee.Text = pagebase.GetSettingsByKey(SageFrameSettingKeys.SuperUserFee); //BinCurrency(); //if (ddlHostingCurrency.Items.Count > 0) //{ // string ExistsCurrency = pagebase.GetSettingsByKey(SageFrameSettingKeys.SuperUserCurrency); // ddlHostingCurrency.SelectedIndex = ddlHostingCurrency.Items.IndexOf(ddlHostingCurrency.Items.FindByText(ExistsCurrency)); //} //txtHostingSpace.Text = pagebase.GetSettingsByKey(SageFrameSettingKeys.SuperUserSpace); //txtPageQuota.Text = pagebase.GetSettingsByKey(SageFrameSettingKeys.PageQuota); //txtUserQuota.Text = pagebase.GetSettingsByKey(SageFrameSettingKeys.UserQuota); //txtDemoPeriod.Text = pagebase.GetSettingsByKey(SageFrameSettingKeys.DemoPeriod); //chkAnonymousDemoSignup.Checked = pagebase.GetSettingBollByKey(SageFrameSettingKeys.DemoSignup); //Advance Setting chkUseFriendlyUrls.Checked = pagebase.GetSettingBollByKey(SageFrameSettingKeys.UseFriendlyUrls); //txtProxyServer.Text = pagebase.GetSettingsByKey(SageFrameSettingKeys.ProxyServer); //txtProxyPort.Text = pagebase.GetSettingsByKey(SageFrameSettingKeys.ProxyPort); //txtProxyUsername.Text = pagebase.GetSettingsByKey(SageFrameSettingKeys.ProxyUsername); //string ProxyPassord = string.Empty; //ProxyPassord = pagebase.GetSettingsByKey(SageFrameSettingKeys.ProxyPassword); //if (!string.IsNullOrEmpty(ProxyPassord)) //{ // txtProxyPassword.Attributes.Add("value", ProxyPassord); //} //txtWebRequestTimeOut.Text = pagebase.GetSettingsByKey(SageFrameSettingKeys.WebRequestTimeout); //SMTP txtSMTPServerAndPort.Text = pagebase.GetSettingsByKey(SageFrameSettingKeys.SMTPServer); BindSMTPAuthntication(); if (rblSMTPAuthentication.Items.Count > 0) { string ExistsSMTPAuth = pagebase.GetSettingsByKey(SageFrameSettingKeys.SMTPAuthentication); if (!string.IsNullOrEmpty(ExistsSMTPAuth)) { rblSMTPAuthentication.SelectedIndex = rblSMTPAuthentication.Items.IndexOf(rblSMTPAuthentication.Items.FindByValue(ExistsSMTPAuth)); } } chkSMTPEnableSSL.Checked = pagebase.GetSettingBollByKey(SageFrameSettingKeys.SMTPEnableSSL); txtSMTPUserName.Text = pagebase.GetSettingsByKey(SageFrameSettingKeys.SMTPUsername); string ExistsSMTPPassword = pagebase.GetSettingsByKey(SageFrameSettingKeys.SMTPPassword); if (!string.IsNullOrEmpty(ExistsSMTPPassword)) { txtSMTPPassword.Attributes.Add("value", ExistsSMTPPassword); } ShowHideSMTPCredentials(); ////JQuery Section //lblVQueryVersion.Text = "3.5";//Need to implemented for relese mode //chkUseJQueryDebugVersion.Checked = pagebase.GetSettingBollByKey(SageFrameSettingKeys.jQueryDebug); //chkUseHostedJQueryVersion.Checked = pagebase.GetSettingBollByKey(SageFrameSettingKeys.jQuerySuperUsered); //txtHostedJQueryURL.Text = pagebase.GetSettingsByKey(SageFrameSettingKeys.jQueryUrl); //Others txtFileExtensions.Text = pagebase.GetSettingsByKey(SageFrameSettingKeys.FileExtensions); txtHelpUrl.Text = pagebase.GetSettingsByKey(SageFrameSettingKeys.HelpURL); }
private bool BindPermissions(bool test) { ///Test Strategy 1 bool status = true; try { SageFrame.Application.Application app = new SageFrame.Application.Application(); PermissionsValid = true; //FolderCreate ListItem permissionItem = new ListItem(); if (test) status = VerifyFolderCreate(); permissionItem.Selected = status; if (!status) { } permissionItem.Enabled = false; permissionItem.Text = "Create Folder"; //FileCreate permissionItem = new ListItem(); if (test) status = VerifyFileCreate(); permissionItem.Selected = status; if (!status) { } permissionItem.Enabled = false; permissionItem.Text = "Create File"; //FileDelete permissionItem = new ListItem(); if (test) status = VerifyFileDelete(); permissionItem.Selected = status; if (!status) { } permissionItem.Enabled = false; permissionItem.Text = "Delete File"; //FolderDelete permissionItem = new ListItem(); if (test) status = VerifyFolderDelete(); permissionItem.Selected = status; if (!status) { } permissionItem.Enabled = false; permissionItem.Text = "Delete Folder"; } catch { } ///Test Strategy 2 bool checkPermission = true; string rootDir = HttpContext.Current.Server.MapPath("~/"); List<KeyValuePair<string, string>> dirsToCheck = new List<KeyValuePair<string, string>>(); dirsToCheck.Add(new KeyValuePair<string, string>(rootDir, Request.ApplicationPath.ToString())); dirsToCheck.Add(new KeyValuePair<string, string>(rootDir + "Install", "Install")); dirsToCheck.Add(new KeyValuePair<string, string>(rootDir + "XMLMessage", "XMLMessage")); dirsToCheck.Add(new KeyValuePair<string, string>(rootDir + "SiteMap", "SiteMap")); StringBuilder sb = new StringBuilder(); sb.Append("Permission Test Failed For : "); List<string> fileList = new List<string>(); foreach (KeyValuePair<string, string> kvp in dirsToCheck) { if (!CheckPermissions(kvp.Key, false, true, true, true) && checkPermission) { fileList.Add(kvp.Value); } } List<KeyValuePair<string, string>> filesToCheck = new List<KeyValuePair<string, string>>(); filesToCheck.Add(new KeyValuePair<string, string>(rootDir + "web.config", "web.config")); filesToCheck.Add(new KeyValuePair<string, string>(rootDir + "version.config", "version.config")); filesToCheck.Add(new KeyValuePair<string, string>(rootDir + "connectionstring.config", "connectionstring.config")); foreach (KeyValuePair<string, string> kvp in filesToCheck) { if (!CheckPermissions(kvp.Key, false, true, true, true) && checkPermission) { fileList.Add(kvp.Value); PermissionsValid = false; } } if (fileList.Count > 0) { sb.Append(String.Join(",", fileList.ToArray()).ToString()); string strPermissionsError = sb.ToString() + "<br> Your site failed the permissions check. Using Windows Explorer, browse to the root folder of the website ( {0} ). Right-click the folder and select Sharing and Security from the popup menu. Select the Security tab. Add the appropriate User Account and set the Permissions.<h3>If using Windows 2000 - IIS5</h3>The {Server}\\ASPNET User Account must have Read, Write, and Change Control of the virtual root of your website.<h3>If using Windows 2003, Windows Vista or Windows Server 2008 and IIS6 or IIS7</h3>The NT AUTHORITY\\NETWORK SERVICE User Account must have Read, Write, and Change Control of the virtual root of your Website.<h3>If using Windows 7 or Windows Server 2008 R2 and IIS7.5</h3>The IIS AppPool\\DefaultAppPool User Account must have Read, Write, and Change Control of the virtual root of your Website."; lblPermissionsError.Text = strPermissionsError.Replace("{0}", Request.ApplicationPath); lblPermissionsError.CssClass = "sfError"; } else { lblPermissionsError.Text = "Your site passed all the permissions check."; lblPermissionsError.CssClass = "sfSuccess"; PermissionsValid = true; } lblPermissionsError.Visible = true; return PermissionsValid; }
private void BindLabelText() { SageFrame.Application.Application app = new SageFrame.Application.Application(); //lblChooseDatabase.Text = "Select Database:"; lblServer.Text = "Server:"; lblServerHelp.Text = "Enter the Name or IP Address of the computer where the Database is located."; //lblDataBase.Text = "Database:"; //lblDatabaseHelp.Text = "Enter the Database name"; lblIntegrated.Text = "Integrated Security:"; lblIntegratedHelp.Text = "Check if the access to SQL server is in Windows Authentication mode. Uncheck if the access to the server is in SQL Server Authentication mode where you will need to provide the username and password."; lblUserID.Text = "User ID:"; lblUserHelp.Text = "User ID to access the server"; lblPassword.Text = "Password:"******"Password to access the server"; lblNewDatabaseHelp.Text = "Enter the New Database Name"; lblExistingDatabaseHelp.Text = "Enter the Existing Database Name."; lblDatabaseNameHelp.Text = "Enter a database name"; //lblOwner.Text = "Run as Owner:"; //lblOwnerHelp.Text = "Check if you are running the database as Database Owner or you will need to provide the User ID."; }
protected void imbCreatePackage_Click(object sender, EventArgs e) { string FullFilePath = ""; List <FileDetails> selectedFiles = new List <FileDetails>(); List <FileDetails> selectedResxFiles = GetSelectedLanguageFiles(this.ddlResourceLocale.SelectedValue.ToString(), selectedFiles, "~/Modules", "*.resx"); selectedResxFiles = GetSelectedLanguageFiles(this.ddlResourceLocale.SelectedValue.ToString(), selectedResxFiles, "~/Modules", "*.js"); selectedResxFiles = GetSelectedLanguageFiles(this.ddlResourceLocale.SelectedValue.ToString(), selectedResxFiles, "~/XMLMessage", "*.xml"); selectedResxFiles = GetSelectedLanguageFiles(this.ddlResourceLocale.SelectedValue.ToString(), selectedResxFiles, "~/Modules", "*.xml"); string filepath = Server.MapPath("~/Install/Language"); if (!Directory.Exists(filepath)) { Directory.CreateDirectory(filepath); } ///Get the application version SageFrame.Application.Application app = new SageFrame.Application.Application(); app.FormatVersion(app.Version, true); StringBuilder fileNameSB = new StringBuilder(); fileNameSB.Append("ResourcePack."); fileNameSB.Append(txtResourcePackName.Text); fileNameSB.Append("."); fileNameSB.Append(app.Version.ToString()); fileNameSB.Append("."); fileNameSB.Append(ddlResourceLocale.SelectedValue.ToString()); string fileName = fileNameSB.ToString(); List <FileDetails> newFileList = new List <FileDetails>(); switch (rbResourcePackType.SelectedIndex) { case 0: newFileList = GetCoreModuleResources(selectedResxFiles);; break; case 1: GetSelectedModules(ref newFileList, selectedResxFiles); break; case 2: newFileList = selectedResxFiles; break; } try { PackageWriterBase.WriteManifest(filepath, "manifest", newFileList, GetPackageInfo()); PackageWriterBase.WriteZipFile(newFileList, filepath + @"/" + fileName + ".zip", filepath + @"\manifest.sfe", "manifest.sfe"); FullFilePath = string.Format("{0}/{1}.zip", filepath, fileName); ViewState["FilePath"] = FullFilePath; if (File.Exists(FullFilePath)) { Response.ClearContent(); Response.AppendHeader("Content-Disposition", "attachment; filename=" + fileName + ".zip"); Response.ContentType = "application/octet-stream"; using (Stream input = File.OpenRead(FullFilePath)) { byte[] buffer = new byte[4096]; int count = input.Read(buffer, 0, buffer.Length); while (count > 0) { Response.OutputStream.Write(buffer, 0, count); count = input.Read(buffer, 0, buffer.Length); } } ShowMessage("", GetSageMessage("LanguageModule", "PackageCreatedSuccessfully"), "", SageMessageType.Success); File.Delete(FullFilePath); } if (rbResourcePackType.SelectedIndex == 1) { divModuleDetails.Visible = true; } } catch (Exception ex) { ProcessException(ex); } finally { Response.End(); } }