protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState); SetContentView(Resource.Layout.activity_main); EditText txtUrl = FindViewById <EditText>(Resource.Id.txtUrl); webView = FindViewById <WebView>(Resource.Id.webView); webView.SetWebViewClient(new ExtendWebViewClient()); WebSettings webSettings = webView.Settings; webSettings.JavaScriptEnabled = true; var btnGo = FindViewById <Button>(Resource.Id.btnGo); btnGo.Click += (s, e) => { string addres = txtUrl.Text.ToLower().Replace(" ", string.Empty); if (!addres.StartsWith("https://")) { txtUrl.Text = $"https://{addres}"; } webView.LoadUrl(txtUrl.Text); }; }
public static void AutoStartNetworks() { App.Instance.RegisterAppFinishNotifiable(SocialNetworkFinisher.Instance); WebSettings.RequireInitializedSettings(); foreach (var snNode in App.ConfigRoot[WebSettings.CONFIG_WEBSETTINGS_SECTION][WebSettings.CONFIG_SOCIAL_SECTION] .Children.Where(cn => cn.IsSameName(WebSettings.CONFIG_SOCIAL_PROVIDER_SECTION))) { var name = snNode.AttrByName(Configuration.CONFIG_NAME_ATTR).Value; if (!snNode.AttrByName(CONFIG_AUTO_START_ATTR).ValueAsBool()) { continue; } var network = FactoryUtils.MakeAndConfigure <SocialNetwork>(snNode, typeof(SocialNetwork), new object[] { null, snNode }); if (s_Instances[network.Name] != null) { continue; // already started } network.Start(); } }
/// <summary> /// Append a line to the applicable log file /// </summary> /// <param name="logEntry">line to add to log</param> public void LogAppend(string logEntry) { // use the timestamp captured when the object was created to identify the file string fname = LogFilename(timestamp); WebSettings ws = new WebSettings(); // create a full path to the target log file string logpath = ws.Lookup("LogPath", HttpContext.Current.Server.MapPath("~/App_Data")); logpath = Path.Combine(logpath, fname); // append to the log file or create it if it doesn't exist if (!File.Exists(logpath)) { using (StreamWriter sw = File.CreateText(logpath)) { sw.WriteLine(logEntry); } } else { using (StreamWriter sw = File.AppendText(logpath)) { sw.WriteLine(logEntry); } } }
void LoadWebview() { WebSettings settings = PartialView.Settings; //启用js事件 settings.SetSupportZoom(true); settings.JavaScriptEnabled = true; //启用js的dom缓存 settings.DomStorageEnabled = true; //加载javascript接口方法,以便调用前台方法 PartialView.AddJavascriptInterface(new AndroidScript(this, PartialView), "AndroidScript"); PartialView.AddJavascriptInterface(new PartialScript(this, PartialView), "PartialScript"); PartialView.AddJavascriptInterface(new BuinessScript(this, PartialView), "BuinessScript"); PartialView.SetWebViewClient(new AgreementRouteClient($"ViewScript.RequestPartial('#MainContent','{PartialLoadForm.Replace}' ,'{Partial.Host}','{Partial.Path}',null);")); SetTitle("首页"); var intColor = Resource.Color.MenuMainPanel_Background; var color = GetColor(intColor); var setting = new Template.Setting { Background = string.Format("#%06X", 0xFFFFFF & color), }; PartialView.LoadDataWithBaseURL("file:///android_asset/", Template.Layout(setting), "text/html", "UTF-8", null); }
/// <summary> /// Construct the UI and start loading /// </summary> public void onCreate() { string startUrl = webSettings.GetString("url"); string title = webSettings.GetString("title"); mainLayout = new LinearLayout(this.context); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent, 0.0F); mainLayout.LayoutParameters = lp; ((LinearLayout)mainLayout).SetGravity(GravityFlags.CenterVertical); ((LinearLayout)mainLayout).Orientation = Orientation.Vertical; webView = new WebView(this.context); WebSettings settings = webView.Settings; settings.JavaScriptEnabled = true; settings.BuiltInZoomControls = true; settings.JavaScriptCanOpenWindowsAutomatically = true; webView.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent, 1.0F); webView.SetWebViewClient(new FHOAuthWebViewClient(this)); webView.RequestFocusFromTouch(); webView.Visibility = ViewStates.Visible; LinearLayout barlayout = initHeaderBar(title); mainLayout.AddView(barlayout); mainLayout.SetBackgroundColor(Color.Transparent); mainLayout.SetBackgroundResource(0); mainLayout.AddView(this.webView); this.webView.LoadUrl(startUrl); }
/// <summary> /// Initialize the BlazorWebView. /// </summary> /// <param name="configure">A delegate that is executed to configure the webview.</param> public void Initialize(Action <WebViewOptions> configure) { var options = new WebViewOptions(); configure.Invoke(options); WebSettings webSettings = this.innerWebView.Settings; webSettings.JavaScriptEnabled = true; WebView.SetWebContentsDebuggingEnabled(true); this.innerWebView.AddJavascriptInterface(new BlazorJavascriptInterface(this), "blazorwebviewinterop"); var resultCallBack = new ValueCallback <string>(s => { // TODO: Handle javascript errors nicer. if (!string.IsNullOrEmpty(s)) { Console.WriteLine(s); } }); var blazorWebViewClient = new BlazorWebViewClient(); this.innerWebView.SetWebViewClient(blazorWebViewClient); foreach (var(schemeName, handler) in options.SchemeHandlers) { blazorWebViewClient.AddCustomScheme(schemeName, handler); } }
public void PortalConfigurationSettingsSerializationTest() { var settings = new WebSettings { ApiDependencyResolver = "Gaia.Portal.Framework.Constants, Gaia.Portal.Framework", MvcDependencyResolver = "Gaia.Portal.Framework.Constants, Gaia.Portal.Framework", FilterProviders = new List <string> { "Gaia.Portal.Framework.Constants, Gaia.Portal.Framework", "Gaia.Portal.Framework.Constants, Gaia.Portal.Framework" } }; var ser = new XmlSerializer(typeof(WebSettings)); byte[] data; using (var ms = new MemoryStream()) { ser.Serialize(ms, settings); data = ms.GetBuffer(); ms.Close(); } var str = Encoding.UTF8.GetString(data); }
/// <inheritdoc/> protected override void OnCreate(Bundle bundle) { #if DEBUG // Allow debugging of JavaScript inside of the WebView. // Debugging can be activated in Chrome by calling "chrome://inspect" WebView.SetWebContentsDebuggingEnabled(true); #endif // Clear the splash screen theme, which is declared as attribute of the activity. SetTheme(Resource.Style.MainTheme); // Load main window of single page application. base.OnCreate(bundle); SetContentView(Resource.Layout.Main); // Prepare the webview _webView = FindViewById <WebView>(Resource.Id.webView); _webView.SetWebViewClient(new HybridWebViewClient( (url) => OnNavigating(url), () => OnNavigationCompleted())); WebSettings settings = _webView.Settings; settings.JavaScriptEnabled = true; settings.BlockNetworkLoads = true; // only local content allowed settings.AllowFileAccess = false; // no local files but from the asset directory settings.SetPluginState(WebSettings.PluginState.Off); // no plugins allowed settings.CacheMode = CacheModes.NoCache; // is already local content }
public CrawlerPeerManager(ApplicationSettings applicationSettings, WebSettings webSettings, List <CrawlerPeer> crawlerPeers, IArachnodeDAO arachnodeDAO) : base(applicationSettings, webSettings, crawlerPeers, arachnodeDAO) { CrawlerPeers = crawlerPeers; if (CrawlerPeers == null || CrawlerPeers.Count == 0) { return; } _cacheItemRemovedCallback = CacheItemRemoved; /**/ //TODO: Fix virtual member constructor call... _localCrawlerPeers = new HashSet <IPEndPoint>(); foreach (CrawlerPeer crawlerPeer in CrawlerPeers.Where(_ => _.IsLocal)) { _localCrawlerPeers.Add(crawlerPeer.IPEndPoint); } if (_localCrawlerPeers.Count == 0) { throw new Exception("No local CrawlerPeers were assigned."); } _initialCrawlerPeerCheckins = new HashSet <IPEndPoint>(); _acceptingThreads = new HashSet <string>(); _receivingThreads = new Dictionary <IPEndPoint, Thread>(); }
/// <summary> /// Automatically starts systems designated in config with auto-start attribute /// </summary> public static void AutoStartSystems() { App.Instance.RegisterAppFinishNotifiable(PayProcessingFinisher.Instance); WebSettings.RequireInitializedSettings(); var pHost = App.ConfigRoot[WebSettings.CONFIG_WEBSETTINGS_SECTION][CONFIG_PAYMENT_PROCESSING_SECTION][CONFIG_PAY_SYSTEM_HOST_SECTION]; if (pHost.Exists) { var host = FactoryUtils.MakeAndConfigure <IPaySystemHostImplementation>(pHost); ___SetPaySystemHost(host); } foreach (var psNode in App.ConfigRoot[WebSettings.CONFIG_WEBSETTINGS_SECTION][CONFIG_PAYMENT_PROCESSING_SECTION] .Children .Where(cn => cn.IsSameName(CONFIG_PAY_SYSTEM_SECTION))) { var name = psNode.AttrByName(Configuration.CONFIG_NAME_ATTR).Value; if (!psNode.AttrByName(CONFIG_AUTO_START_ATTR).ValueAsBool()) { continue; } var system = FactoryUtils.MakeAndConfigure <PaySystem>(psNode, typeof(PaySystem), new object[] { null, psNode }); if (s_Instances[system.Name] != null) // already started { throw new PaymentException("AutoStart: " + StringConsts.PAYMENT_SYSTEM_DUPLICATE_NAME_ERROR.Args(system.GetType().FullName, system.Name)); } system.Start(); } }
public ActionResult EvaluateApplication(int?appId, int statId = 2) { int datId = WebSettings.getCurrentDate(); if (appId == null) { return(RedirectToAction("DisplayApplications")); } Application app = ent.Applications.Where(m => m.AppId == (int)appId).FirstOrDefault(); if (app == null) { return(RedirectToAction("DisplayApplications")); } app.ASTypId = statId; app.UserIdEvaluated = User.Identity.GetUserId(); app.DSetIdEvaluated = datId; ent.Entry(app).State = System.Data.Entity.EntityState.Modified; ent.SaveChanges(); return(RedirectToAction("DisplayApplications")); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Panorama); SelectionNumber = Intent.Extras.GetInt("SelectionNumber"); // Create your application here var WebViewPanorama = FindViewById <WebView>(Resource.Id.webViewPanorama); WebSettings webSettings = WebViewPanorama.Settings; webSettings.JavaScriptEnabled = true; WebViewPanorama.Settings.SetRenderPriority(WebSettings.RenderPriority.High); WebViewPanorama.SetWebViewClient(new WebViewClient()); if (SelectionNumber == 0) { Galeria galeria = service.HttpGet <Galeria>(constants.Url, constants.GaleriaController, constants.GaleriaMethod, "code=16"); WebViewPanorama.LoadUrl(galeria.Url); //WebViewPanorama.LoadUrl("https://momento360.com/e/u/b6dc4b4cfd8b4cb08df599d7140b9d95?utm_campaign=embed&utm_source=other&utm_medium=other&heading=0&pitch=0&field-of-view=100"); } else { Galeria galeria = service.HttpGet <Galeria>(constants.Url, constants.GaleriaController, constants.GaleriaMethod, "code=20"); WebViewPanorama.LoadUrl(galeria.Url); //WebViewPanorama.LoadUrl(" https://momento360.com/e/u/f74c54af6077455fa3de5914c4b3b92c?utm_campaign=embed&utm_source=other&utm_medium=other&heading=0&pitch=0&field-of-view=75"); } WebViewPanorama.Settings.JavaScriptEnabled = true; WebViewPanorama.Settings.BuiltInZoomControls = true; WebViewPanorama.Settings.SetSupportZoom(true); WebViewPanorama.ScrollBarStyle = ScrollbarStyles.OutsideOverlay; WebViewPanorama.ScrollbarFadingEnabled = false; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Memes); Context context = Application.Context; ////////////////////////МЕНЮ\\\\\\\\\\\\\\\\\\\\\\ drawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout); var toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id._app_bar); SetSupportActionBar(toolbar); SupportActionBar.SetTitle(Resource.String.app_name); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetDisplayShowHomeEnabled(true); var navigationView = FindViewById <NavigationView>(Resource.Id.nav_view); navigationView.NavigationItemSelected += NavigationView_NavigationItemSelected;; var drawerToogle = new ActionBarDrawerToggle(this, drawerLayout, toolbar, Resource.String.open_drawer, Resource.String.close_drawer); drawerLayout.AddDrawerListener(drawerToogle); drawerToogle.SyncState(); ////////////////////////МЕНЮ\\\\\\\\\\\\\\\\\\\\\\ string txtUrl = context.Resources.GetString(Resource.String.memesURL); webView = FindViewById <WebView>(Resource.Id.webView); webView.SetWebViewClient(new ExtendWebViewClient()); WebSettings webSettings = webView.Settings; webSettings.JavaScriptEnabled = true; webView.LoadUrl(txtUrl); }
public HttpConsumerFactory(IOptions <WebSettings> options) { // Dependency injection settings = options.Value; baseUrl = new Uri(settings.BaseUrlAPI); }
public static void Refresh() { try { using (VendingModelContainer dc = new VendingModelContainer()) { WebSettings tmpws = dc.WebSettings.First(); AdminEmail = tmpws.AdminEmail; SiteName = tmpws.SiteName; ServerEndPoint = tmpws.ServerEndPoint; MailFromAddress = tmpws.MailFromAddress; EMailDisplayName = tmpws.EMailDisplayName; EMailDisplayName = tmpws.EMailDisplayName; RegDeviceMailSubject = tmpws.RegDeviceMailSubject; RegAccountMailSubject = tmpws.RegAccountMailSubject; MailUseSMTPAuth = tmpws.MailUseSMTPAuth; MailLogin = tmpws.MailLogin; MailPassword = tmpws.MailPassword; SMTPHost = tmpws.SMTPHost; SMTPPort = tmpws.SMTPPort; SMTPUseSSL = tmpws.SMTPUseSSL; BingMapsAPIKey = tmpws.BingMapsAPIKey; } } catch { } }
protected void Page_Load(object sender, EventArgs e) { NewAccountButton.Click += new EventHandler(NewAccountButton_Click); // this page requires an authenticated user Master.ForceAuthentication(); // this page requires an authenticated administrator Master.ForceAdministrator(); // create the configuration related objects webSettings = new WebSettings(); fz = new Filezilla(webSettings.Lookup("ConfigurationFile")); // load the user grid display List<FilezillaUser> userList = new List<FilezillaUser>(); int count = fz.AddUsersToList(ref userList); UserGridView.DataSource = userList; UserGridView.DataBind(); DataSet ds = new DataSet(); ds.ReadXml(MapPath("~/App_Data/settings.xml")); SettingsGridView.DataSource = ds.Tables[0].DefaultView; SettingsGridView.DataBind(); if (!Page.IsPostBack) { UserGridView.SortBy(UserGridView.Columns["Username"], ColumnSortOrder.Ascending); UserGridView.SettingsPager.PageSize = 100; SettingsGridView.SortBy(SettingsGridView.Columns["key"], ColumnSortOrder.Ascending); SettingsGridView.SettingsPager.PageSize = 100; } }
/// <summary> /// Initializes a new instance of the <see cref = "InvalidConfigurationException" /> class. /// </summary> /// <param name = "applicationSettings">The application settings.</param> /// <param name = "webSettings">The web settings.</param> /// <param name = "message">The message.</param> public InvalidConfigurationException(ApplicationSettings applicationSettings, WebSettings webSettings, string message, InvalidConfigurationExceptionSeverity invalidConfigurationExceptionSeverity) { ApplicationSettings = applicationSettings; WebSettings = webSettings; Message = message; InvalidConfigurationExceptionSeverity = invalidConfigurationExceptionSeverity; }
public static void AutoStartSystems() { App.Instance.RegisterAppFinishNotifiable(ShippingProcessingFinisher.Instance); WebSettings.RequireInitializedSettings(); var ssHost = App.ConfigRoot[WebSettings.CONFIG_WEBSETTINGS_SECTION][CONFIG_SHIPPING_PROCESSING_SECTION][CONFIG_SHIPPING_SYSTEM_HOST_SECTION]; if (ssHost.Exists) { var host = FactoryUtils.MakeAndConfigure <ShippingSystemHost>(ssHost, typeof(ShippingSystemHost), new object[] { null, ssHost }); host.Start(); ___SetShippingSystemHost(host); } foreach (var ssNode in App.ConfigRoot[WebSettings.CONFIG_WEBSETTINGS_SECTION][CONFIG_SHIPPING_PROCESSING_SECTION] .Children .Where(c => c.IsSameName(CONFIG_SHIPPING_SYSTEM_SECTION))) { if (!ssNode.AttrByName(CONFIG_AUTO_START_ATTR).ValueAsBool()) { continue; } var name = ssNode.AttrByName(Configuration.CONFIG_NAME_ATTR).Value; var system = FactoryUtils.MakeAndConfigure <ShippingSystem>(ssNode, typeof(ShippingSystem), new object[] { null, ssNode }); system.Start(); } }
/// <inheritdoc/> protected override void OnCreate(Bundle bundle) { #if DEBUG // Allow debugging of JavaScript inside of the WebView. // Debugging can be activated in Chrome by calling "chrome://inspect" WebView.SetWebContentsDebuggingEnabled(true); #endif // Clear the splash screen theme, which is declared as attribute of the activity. SetTheme(Resource.Style.MainTheme); _activityResultAwaiter = new ActivityResultAwaiter(this); Startup.InitializeApplication(this, _activityResultAwaiter); ConsumeActionSendIntentParameter(Intent); // Load main window of single page application. base.OnCreate(bundle); SetContentView(Resource.Layout.Main); // Prepare the webview _webView = FindViewById <WebView>(Resource.Id.webView); _webView.SetWebViewClient(new HybridWebViewClient( (url) => OnNavigating(url), () => OnNavigationCompleted())); WebSettings settings = _webView.Settings; settings.JavaScriptEnabled = true; settings.BlockNetworkLoads = true; // only local content allowed settings.AllowFileAccess = false; // no local files but from the asset directory settings.SetPluginState(WebSettings.PluginState.Off); // no plugins allowed settings.CacheMode = CacheModes.NoCache; // is already local content settings.JavaScriptCanOpenWindowsAutomatically = false; // same as default settings.SetSupportMultipleWindows(false); // same as default settings.TextZoom = 100; // Ignores system font size, so the app controls the font size }
//don't call the base implementation as it references SQL Server specific commands... public ArachnodeDAOMongo(string connectionString, ApplicationSettings applicationSettings, WebSettings webSettings, bool initializeApplicationConfiguration, bool initializeWebConfiguration) : base(connectionString, applicationSettings, webSettings, initializeApplicationConfiguration, initializeWebConfiguration) { ConnectionString.Value = connectionString; _applicationSettings = applicationSettings; if (_applicationSettings != null) { _applicationSettings.ConnectionString = connectionString; } _webSettings = webSettings; if (_webSettings != null) { _webSettings.ConnectionString = connectionString; } InitializeMongoDB(); CheckVersion(); if (initializeApplicationConfiguration) { ConfigurationManager.InitializeConfiguration(ref _applicationSettings, ref _webSettings, ConfigurationType.Application, this); } if (initializeWebConfiguration) { ConfigurationManager.InitializeConfiguration(ref _applicationSettings, ref _webSettings, ConfigurationType.Web, this); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.web_application_view); // Create your application here //akong gideclare ang url sa official website string sourceURL = "https://spmi-health-declaration.vercel.app/login"; //akong gitawag ang id gikan sa xml webView1 = FindViewById <WebView>(Resource.Id.webView1); imageView1 = FindViewById <ImageView>(Resource.Id.imageView1); //loadingBar = FindViewById<ProgressBar>(Resource.Id.progressBar1); //akong gitawag ang internal class na WebViewClientClass webView1.SetWebViewClient(new WebViewClientClass(this)); //gipasa dire ang url string na ako gideclara webView1.LoadUrl(sourceURL); //gi configure ang javascript para mugana sa akong application WebSettings websettings = webView1.Settings; websettings.JavaScriptEnabled = true; }
void InitWebViewSettings() { WebSettings webSetting = this.Settings; webSetting.JavaScriptEnabled = (true); webSetting.JavaScriptCanOpenWindowsAutomatically = (true); webSetting.AllowFileAccess = (true); webSetting.SetLayoutAlgorithm(LayoutAlgorithm.NarrowColumns); webSetting.SetSupportZoom(true); webSetting.BuiltInZoomControls = (true); webSetting.UseWideViewPort = (true); webSetting.SetSupportMultipleWindows(true); // webSetting.LoadWithOverviewMode(true); webSetting.SetAppCacheEnabled(true); // webSetting.DatabaseEnabled(true); webSetting.DomStorageEnabled = (true); webSetting.SetGeolocationEnabled(true); webSetting.SetAppCacheMaxSize(Long.MaxValue); // webSetting.PageCacheCapacity(IX5WebSettings.DEFAULT_CACHE_CAPACITY); webSetting.SetPluginState(WebSettings.PluginState.OnDemand); // webSetting.RenderPriority(WebSettings.RenderPriority.HIGH); webSetting.CacheMode = (WebSettings.LoadNoCache); // this.getSettingsExtension().PageCacheCapacity(IX5WebSettings.DEFAULT_CACHE_CAPACITY);//extension // settings 的设计 }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.SearchInternet); //инициализация элементов webView = FindViewById <Android.Webkit.WebView>(Resource.Id.webView1); textURL = FindViewById <EditText>(Resource.Id.editText1); textURL.Visibility = Android.Views.ViewStates.Invisible; SelectionUrl = FindViewById <RadioGroup>(Resource.Id.radioGroup1); SelectionUrl.CheckedChange += VibrUrl_CheckedChange; ShowSearchBar = FindViewById <CheckBox>(Resource.Id.checkBox1); ShowSearchBar.CheckedChange += ShowSearchBar_CheckedChange; webView.SetWebViewClient(new ExtendWebViewClient()); //продключаем js WebSettings webSettings = webView.Settings; webSettings.JavaScriptEnabled = true; //предзагрузка ссылки на сайт с данными из динамичской строки base.OnStart(); if (!textURL.Text.Contains("https://www.ozon.ru/?context=search&text=")) { string address = textURL.Text; textURL.Text = string.Format("https://www.ozon.ru/?context=search&text={0}", MainActivity.sv); } webView.LoadUrl(textURL.Text); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState); SetContentView(Resource.Layout.activity_main); Accelerometer.ShakeDetected += ShakeDetected; btnComprar = FindViewById <Button>(Resource.Id.btnComprar); btnCarrinho = FindViewById <Button>(Resource.Id.btnCarrinho); webViewInicial = FindViewById <WebView>(Resource.Id.webViewInicial); btnComprar.Click += BtnComprar_Click; btnCarrinho.Click += BtnCarrinho_Click; btnAjuda = FindViewById <Button>(Resource.Id.btnAjuda); btnAjuda.Click += BtnAjuda_Click; webViewInicial.SetWebViewClient(new ExtendWebViewClient()); webViewInicial.LoadUrl("https://www.natura.com.br/c/tudo-em-promocoes"); webViewInicial.Settings.DomStorageEnabled = true; WebSettings webSettings = webViewInicial.Settings; webSettings.JavaScriptEnabled = true; ToggleAccelerometer(); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Create your application here SetContentView(Resource.Layout.WebAuthenticationBroker); string url = Intent.GetStringExtra("Url"); WebView webView = FindViewById <WebView>(Resource.Id.agentWebView); WebSettings webSettings = webView.Settings; string userAgent = webSettings.UserAgentString; webSettings.UserAgentString = userAgent + BrokerConstants.ClientTlsNotSupported; PlatformPlugin.Logger.Verbose(null, "UserAgent:" + webSettings.UserAgentString); webSettings.JavaScriptEnabled = true; webSettings.LoadWithOverviewMode = true; webSettings.DomStorageEnabled = true; webSettings.UseWideViewPort = true; webSettings.BuiltInZoomControls = true; this.client = new AdalWebViewClient(Intent.GetStringExtra("Callback")); webView.SetWebViewClient(client); webView.LoadUrl(url); }
protected override void OnCreate(Bundle savedInstanceState) { RequestPermission(); _powerManager = (PowerManager)GetSystemService(PowerService); _wakeLock = _powerManager.NewWakeLock(WakeLockFlags.Full, "@string/app_name"); base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_main); Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); MobileBarcodeScanner.Initialize(Application); WebView webView = FindViewById <WebView>(Resource.Id.webView); webView.SetWebChromeClient(new WebChromeClient()); webView.SetWebViewClient(new WebViewClient()); webView.Settings.JavaScriptCanOpenWindowsAutomatically = true; webView.Settings.JavaScriptEnabled = true; webView.Settings.AllowFileAccessFromFileURLs = true; webView.Settings.AllowUniversalAccessFromFileURLs = true; webView.Settings.AllowFileAccess = true; webView.ClearHistory(); webView.ClearCache(true); WebSettings webSettings = webView.Settings; webSettings.SetAppCacheEnabled(false); webView.AddJavascriptInterface(new QRScannerJSInterface(webView, this), "CSharpQRInterface"); webView.LoadUrl("file:///android_asset/TestBarCode/testbarcode.html"); //webView.LoadUrl("http://IP-YOURWEBSERVER/testbarcode.html"); //if you want to test on your web server, copy testbarcode.html on your web server }
public ActionResult RequestStatus() { try { if (User.IsInRole("Student")) { if (!WebSettings.IsValidationOpen()) { return(RedirectToAction("StudentScholarship")); } ViewBag.errorMessage = TempData["errorMessage"]; return(View(studentActions.GetMyRequest(WebSettings.CurrentPeriod().PeriodID, User.Identity.GetUserId()))); } else { TempData["errorMessage"] = "Sorry you do not have access."; return(RedirectToAction("Announcement", "WebsiteContent")); } } catch (Exception e) { ViewBag.errorMessage = "There was an error in displaying your validation requests. Please try again, thank you!" + e.ToString(); return(View()); } }
private void LoadWebView() { try { //Set WebView WebSettings webSettings = HybridView.Settings; HybridView.SetWebViewClient(new MyWebViewClient(this)); HybridView.SetWebChromeClient(new WebChromeClient()); webSettings.JavaScriptEnabled = true; webSettings.AllowFileAccess = true; webSettings.LoadsImagesAutomatically = true; webSettings.JavaScriptCanOpenWindowsAutomatically = true; webSettings.SetLayoutAlgorithm(WebSettings.LayoutAlgorithm.TextAutosizing); webSettings.DomStorageEnabled = true; webSettings.UseWideViewPort = (true); webSettings.LoadWithOverviewMode = (true); webSettings.SetSupportZoom(false); webSettings.BuiltInZoomControls = (false); webSettings.DisplayZoomControls = (false); HybridView.ClearCache(true); HybridView.Settings.LoadWithOverviewMode = true; HybridView.CopyBackForwardList(); HybridView.CanGoBackOrForward(0); //Load url to be rendered on WebView HybridView.LoadUrl(Url); } catch (Exception e) { Console.WriteLine(e); } }
/// <summary> /// Сохранить настройки /// </summary> private void SaveSettings() { // загрузка актуальных настроек WebSettings webSettings = new WebSettings(); string errMsg; string fileName = appData.AppDirs.ConfigDir + WebSettings.DefFileName; if (!webSettings.LoadFromFile(fileName, out errMsg)) { appData.Log.WriteError(errMsg); } // проверка и сохранение настроек if (ControlsToSettings(webSettings, out errMsg)) { if (webSettings.SaveToFile(fileName, out errMsg)) { userData.ReLogin(); userData.CheckLoggedOn(true); pnlSuccMsg.ShowAlert(PlgPhrases.ConfigSaved); } else { appData.Log.WriteError(errMsg); pnlErrMsg.ShowAlert(errMsg); } } else { pnlErrMsg.ShowAlert(errMsg); } }
public ActionResult Scholars(int? scholarshipID) { List<PreValidatedStudent> scholarList = null; try { if(scholarshipID == null) { return RedirectToAction("ScholarSelection"); } else { scholarList = websiteActions.GetScholarsByScholarshipID((int)scholarshipID) .Where(model => model.PeriodID == WebSettings.CurrentPeriod().PeriodID) .OrderBy(model => model.AspNetUser.UserProfiles.FirstOrDefault().StudentProfile.LastName) .ToList(); if(scholarList.Count() > 0) { return View(scholarList); } TempData["errorMessage"] = "Sorry but there are no scholars for that scholarship."; return RedirectToAction("ScholarSelection"); } } catch (Exception e) { TempData["errorMessage"] = "Sorry there was an error in displaying the the list of scholars. Please try again."; return RedirectToAction("ScholarSelection"); } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Main); imageView = FindViewById <ImageView>(Resource.Id.imageView); _imageView = imageView; webView = FindViewById <WebView>(Resource.Id.webView); button = FindViewById <Button>(Resource.Id.button); text_View = FindViewById <TextView>(Resource.Id.text_view); progressBar1 = FindViewById <ProgressBar>(Resource.Id.progressBar1); progressBar1.IndeterminateDrawable.SetColorFilter(Color.ParseColor("#63064c"), Android.Graphics.PorterDuff.Mode.Multiply); _progressBar1 = progressBar1; _webView = webView; _button = button; _text_View = text_View; webView.SetWebViewClient(new MyWebViewClient()); WebSettings webSettings = webView.Settings; webSettings.JavaScriptEnabled = true; webSettings.SetPluginState(WebSettings.PluginState.On); // pageLoad(); // MyWebViewClient.setIsOnline(isConnectionOn()); button.Click += delegate { buttonClick(); }; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Create your application here WebView webView = new WebView(ApplicationContext); var relativeLayout = new RelativeLayout(ApplicationContext); webView.LayoutParameters = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.MatchParent); relativeLayout.AddView(webView); SetContentView(relativeLayout); string url = Intent.GetStringExtra("Url"); WebSettings webSettings = webView.Settings; string userAgent = webSettings.UserAgentString; webSettings.UserAgentString = userAgent + BrokerConstants.ClientTlsNotSupported; MsalLogger.Default.Verbose("UserAgent:" + webSettings.UserAgentString); webSettings.JavaScriptEnabled = true; webSettings.LoadWithOverviewMode = true; webSettings.DomStorageEnabled = true; webSettings.UseWideViewPort = true; webSettings.BuiltInZoomControls = true; this._client = new CoreWebViewClient(Intent.GetStringExtra("Callback"), this); webView.SetWebViewClient(_client); webView.LoadUrl(url); }
protected void Page_Load(object sender, EventArgs e) { // wire the events GeneratePasswordButton.Click += new EventHandler(GeneratePasswordButton_Click); ForcePasswordButton.Click += new EventHandler(ForcePasswordButton_Click); // this page requires an authenticated user Master.ForceAuthentication(); // this page requires an authenticated administrator Master.ForceAdministrator(); // get the target user from the query string userName = WebConvert.ToString(Request.QueryString["ID"], ""); // create the configuration related objects webSettings = new WebSettings(); fz = new Filezilla(webSettings.Lookup("ConfigurationFile")); // load the user object fzu = fz.GetUser(userName); if (!Page.IsPostBack) { // load the display with the user values UsernameTitleLiteral.Text = fzu.Username; UsernameLabel.Text = fzu.Username; PasswordLabel.Text = fzu.Password; EnabledLabel.Text = (fzu.Enabled) ? "Yes" : "No"; HomeDirectoryLabel.Text = fzu.Home; // load the first permission FilezillaPermission fzp = fzu.Permissions[0]; DirectoryLabel.Text = fzp.Dir; AliasPathLabel.Text = fzp.AliasPath; IsHomeLabel.Text = (fzp.OptionIsHome) ? "Yes" : "No"; FilePermissionsLabel.Text = ""; FilePermissionsLabel.Text += DisplayPermission("Read", fzp.OptionFileRead ); FilePermissionsLabel.Text += DisplayPermission("Write", fzp.OptionFileWrite); FilePermissionsLabel.Text += DisplayPermission("Delete", fzp.OptionFileDelete); FilePermissionsLabel.Text += DisplayPermission("Append", fzp.OptionFileAppend); DirPermissionsLabel.Text = ""; DirPermissionsLabel.Text += DisplayPermission("List", fzp.OptionDirList); DirPermissionsLabel.Text += DisplayPermission("Create", fzp.OptionDirCreate); DirPermissionsLabel.Text += DisplayPermission("Delete", fzp.OptionDirDelete); DirPermissionsLabel.Text += DisplayPermission("Subdirs", fzp.OptionDirSubdirs); AutoCreateLabel.Text = (fzp.OptionAutoCreate) ? "Yes" : "No"; } }
public bool Validate(WebSettings sourceWebsettings, WebSettings targetWebSettings, TokenParser tokenParser) { ProvisioningTemplate sourcePt = new ProvisioningTemplate(); sourcePt.WebSettings = sourceWebsettings; var sourceXml = ExtractElementXml(sourcePt); ProvisioningTemplate targetPt = new ProvisioningTemplate(); targetPt.WebSettings = targetWebSettings; var targetXml = ExtractElementXml(targetPt); Dictionary<string, string[]> parserSettings = new Dictionary<string, string[]>(); List<string> parsedProperties = new List<string>(); parsedProperties.AddRange(new string[] { "MasterPageUrl", "CustomMasterPageUrl", "Description", "Title", "SiteLogo", "WelcomePage", "AlternateCSS" }); return ValidateObjectXML(sourceXml, targetXml, parsedProperties, tokenParser, parserSettings); }
protected void Page_Load(object sender, EventArgs e) { // this page requires an authenticated user Master.ForceAuthentication(); // access the settings settings = new WebSettings(); if (!Page.IsPostBack) { } // Wire the events LoginButton.Click += new EventHandler(LoginButton_Click); // set the focus AccPasswordTextBox.Focus(); }
protected void Page_Load(object sender, EventArgs e) { // access the settings settings = new WebSettings(); if (!Page.IsPostBack) { string contactEmail = settings.Lookup("ContactEMail"); // load the literals from the settings NeedAccountEmailLiteral.Text = "<a href=\"mailto:" + contactEmail + "\">" + contactEmail + "</a>"; ForgetPasswordLiteral.Text = "<a href=\"mailto:" + contactEmail + "\">" + contactEmail + "</a>"; } // Wire the events LoginButton.Click += new EventHandler(LoginButton_Click); // set the focus AccAccountTextBox.Focus(); }
/// <summary> /// Send an email message. /// </summary> /// <param name="subject">Subject text for the message</param> /// <param name="body">Body text for the message</param> /// <param name="recipients">A comma-delimited list of recipients that will receive the message</param> /// <returns>True if the email is sent; otherwise false.</returns> public static bool Send(string subject, string body, string recipients) { if (recipients.Length < 1) { return false; } WebSettings ws = new WebSettings(); // Get the configured EMail infromation from the web config string EmailAccount = ws.Lookup("EmailAccount"); string EmailPassword = ws.Lookup("EmailPassword"); string EmailSender = ws.Lookup("EmailSender"); string EmailReplyTo = ws.Lookup("EmailReplyTo"); string EmailSenderName = ws.Lookup("EmailSenderName"); string EmailServer = ws.Lookup("EmailServer"); int EmailPort = WebConvert.ToInt32(ws.Lookup("EmailPort", "25"), 25); // make the credentials for connecting to the server NetworkCredential smtpuser = new NetworkCredential(EmailAccount, EmailPassword); // create the mail message MailMessage mail = new MailMessage(); mail.From = new MailAddress(EmailSender, EmailSenderName); mail.To.Add(recipients); mail.ReplyToList.Add(new MailAddress(EmailReplyTo)); mail.Sender = new MailAddress(EmailSender); mail.Subject = subject; mail.Body = body; mail.IsBodyHtml = false; // connect to the smtp client and send the message SmtpClient client = new SmtpClient(EmailServer); client.UseDefaultCredentials = false; client.Credentials = smtpuser; client.Port = EmailPort; client.Send(mail); return true; }
/// <summary> /// Load the master page components - customization based on this instance /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { WebSettings webSettings = new WebSettings(); InstanceNameLabel.Text = webSettings.Lookup("InstanceName", "N/A"); // update the footer with the running version number VersionLiteral.Text = WebVersion.Latest(); // display the active user account AccountLiteral.Text = UserName; // turn the account panel on only if a user has authenticated AccountPanel.Visible = IsAuthenticated(); // prefix the page title with the instance marker Page.Title = webSettings.Lookup("InstancePageTitle", "") + " FileZilla.NET by )|( Sanctuary Software Studio, Inc."; // check to see if SSL is required and redirect there if it is required if (WebConvert.ToBoolean(webSettings.Lookup("ForceSSL", "0"), false)) { // verify that we are on a secure connection ForceSSL(); } }
static void ConfigureWebSettings (WebSettings settings) { settings.JavaScriptEnabled = true; settings.AllowFileAccessFromFileURLs = true; settings.AllowUniversalAccessFromFileURLs = true; }
// Generates content of webSettingsPart1. private void GenerateWebSettingsPart1Content(WebSettingsPart webSettingsPart1) { WebSettings webSettings1 = new WebSettings(); webSettings1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships"); webSettings1.AddNamespaceDeclaration("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main"); OptimizeForBrowser optimizeForBrowser1 = new OptimizeForBrowser(); webSettings1.Append(optimizeForBrowser1); webSettingsPart1.WebSettings = webSettings1; }
public override ProvisioningTemplate ExtractObjects(Web web, ProvisioningTemplate template, ProvisioningTemplateCreationInformation creationInfo) { using (var scope = new PnPMonitoredScope(this.Name)) { web.EnsureProperties( #if !ONPREMISES w => w.NoCrawl, w => w.RequestAccessEmail, #endif //w => w.Title, //w => w.Description, w => w.MasterUrl, w => w.CustomMasterUrl, w => w.SiteLogoUrl, w => w.RootFolder, w => w.AlternateCssUrl, w => w.Url); var webSettings = new WebSettings(); #if !ONPREMISES webSettings.NoCrawl = web.NoCrawl; webSettings.RequestAccessEmail = web.RequestAccessEmail; #endif // We're not extracting Title and Description //webSettings.Title = Tokenize(web.Title, web.Url); //webSettings.Description = Tokenize(web.Description, web.Url); webSettings.MasterPageUrl = Tokenize(web.MasterUrl, web.Url); webSettings.CustomMasterPageUrl = Tokenize(web.CustomMasterUrl, web.Url); webSettings.SiteLogo = Tokenize(web.SiteLogoUrl, web.Url); // Notice. No tokenization needed for the welcome page, it's always relative for the site webSettings.WelcomePage = web.RootFolder.WelcomePage; webSettings.AlternateCSS = Tokenize(web.AlternateCssUrl, web.Url); template.WebSettings = webSettings; if (creationInfo.PersistBrandingFiles) { if (!string.IsNullOrEmpty(web.MasterUrl)) { var masterUrl = web.MasterUrl.ToLower(); if (!masterUrl.EndsWith("default.master") && !masterUrl.EndsWith("custom.master") && !masterUrl.EndsWith("v4.master") && !masterUrl.EndsWith("seattle.master") && !masterUrl.EndsWith("oslo.master")) { if (PersistFile(web, creationInfo, scope, web.MasterUrl)) { template.Files.Add(GetTemplateFile(web, web.MasterUrl)); } } } if (!string.IsNullOrEmpty(web.CustomMasterUrl)) { var customMasterUrl = web.CustomMasterUrl.ToLower(); if (!customMasterUrl.EndsWith("default.master") && !customMasterUrl.EndsWith("custom.master") && !customMasterUrl.EndsWith("v4.master") && !customMasterUrl.EndsWith("seattle.master") && !customMasterUrl.EndsWith("oslo.master")) { if (PersistFile(web, creationInfo, scope, web.CustomMasterUrl)) { template.Files.Add(GetTemplateFile(web, web.CustomMasterUrl)); } } } if (!string.IsNullOrEmpty(web.SiteLogoUrl)) { if (PersistFile(web, creationInfo, scope, web.SiteLogoUrl)) { template.Files.Add(GetTemplateFile(web, web.SiteLogoUrl)); } } if (!string.IsNullOrEmpty(web.AlternateCssUrl)) { if (PersistFile(web, creationInfo, scope, web.AlternateCssUrl)) { template.Files.Add(GetTemplateFile(web, web.AlternateCssUrl)); } } } var files = template.Files.Distinct().ToList(); template.Files.Clear(); template.Files.AddRange(files); } return template; }
// Generates content of webSettingsPart1. private void GenerateWebSettingsPart1Content(WebSettingsPart webSettingsPart1) { WebSettings webSettings1 = new WebSettings(); Divs divs1 = new Divs(); Div div1 = new Div() { Id = "110056252" }; BodyDiv bodyDiv1 = new BodyDiv() { Val = true }; LeftMarginDiv leftMarginDiv1 = new LeftMarginDiv() { Val = "0" }; RightMarginDiv rightMarginDiv1 = new RightMarginDiv() { Val = "0" }; TopMarginDiv topMarginDiv1 = new TopMarginDiv() { Val = "0" }; BottomMarginDiv bottomMarginDiv1 = new BottomMarginDiv() { Val = "0" }; DivBorder divBorder1 = new DivBorder(); TopBorder topBorder13 = new TopBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U }; LeftBorder leftBorder7 = new LeftBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U }; BottomBorder bottomBorder15 = new BottomBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U }; RightBorder rightBorder7 = new RightBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U }; divBorder1.Append(topBorder13); divBorder1.Append(leftBorder7); divBorder1.Append(bottomBorder15); divBorder1.Append(rightBorder7); div1.Append(bodyDiv1); div1.Append(leftMarginDiv1); div1.Append(rightMarginDiv1); div1.Append(topMarginDiv1); div1.Append(bottomMarginDiv1); div1.Append(divBorder1); Div div2 = new Div() { Id = "454059354" }; BodyDiv bodyDiv2 = new BodyDiv() { Val = true }; LeftMarginDiv leftMarginDiv2 = new LeftMarginDiv() { Val = "0" }; RightMarginDiv rightMarginDiv2 = new RightMarginDiv() { Val = "0" }; TopMarginDiv topMarginDiv2 = new TopMarginDiv() { Val = "0" }; BottomMarginDiv bottomMarginDiv2 = new BottomMarginDiv() { Val = "0" }; DivBorder divBorder2 = new DivBorder(); TopBorder topBorder14 = new TopBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U }; LeftBorder leftBorder8 = new LeftBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U }; BottomBorder bottomBorder16 = new BottomBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U }; RightBorder rightBorder8 = new RightBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U }; divBorder2.Append(topBorder14); divBorder2.Append(leftBorder8); divBorder2.Append(bottomBorder16); divBorder2.Append(rightBorder8); div2.Append(bodyDiv2); div2.Append(leftMarginDiv2); div2.Append(rightMarginDiv2); div2.Append(topMarginDiv2); div2.Append(bottomMarginDiv2); div2.Append(divBorder2); Div div3 = new Div() { Id = "802694763" }; BodyDiv bodyDiv3 = new BodyDiv() { Val = true }; LeftMarginDiv leftMarginDiv3 = new LeftMarginDiv() { Val = "0" }; RightMarginDiv rightMarginDiv3 = new RightMarginDiv() { Val = "0" }; TopMarginDiv topMarginDiv3 = new TopMarginDiv() { Val = "0" }; BottomMarginDiv bottomMarginDiv3 = new BottomMarginDiv() { Val = "0" }; DivBorder divBorder3 = new DivBorder(); TopBorder topBorder15 = new TopBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U }; LeftBorder leftBorder9 = new LeftBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U }; BottomBorder bottomBorder17 = new BottomBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U }; RightBorder rightBorder9 = new RightBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U }; divBorder3.Append(topBorder15); divBorder3.Append(leftBorder9); divBorder3.Append(bottomBorder17); divBorder3.Append(rightBorder9); div3.Append(bodyDiv3); div3.Append(leftMarginDiv3); div3.Append(rightMarginDiv3); div3.Append(topMarginDiv3); div3.Append(bottomMarginDiv3); div3.Append(divBorder3); Div div4 = new Div() { Id = "1232883998" }; BodyDiv bodyDiv4 = new BodyDiv() { Val = true }; LeftMarginDiv leftMarginDiv4 = new LeftMarginDiv() { Val = "0" }; RightMarginDiv rightMarginDiv4 = new RightMarginDiv() { Val = "0" }; TopMarginDiv topMarginDiv4 = new TopMarginDiv() { Val = "0" }; BottomMarginDiv bottomMarginDiv4 = new BottomMarginDiv() { Val = "0" }; DivBorder divBorder4 = new DivBorder(); TopBorder topBorder16 = new TopBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U }; LeftBorder leftBorder10 = new LeftBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U }; BottomBorder bottomBorder18 = new BottomBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U }; RightBorder rightBorder10 = new RightBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U }; divBorder4.Append(topBorder16); divBorder4.Append(leftBorder10); divBorder4.Append(bottomBorder18); divBorder4.Append(rightBorder10); div4.Append(bodyDiv4); div4.Append(leftMarginDiv4); div4.Append(rightMarginDiv4); div4.Append(topMarginDiv4); div4.Append(bottomMarginDiv4); div4.Append(divBorder4); divs1.Append(div1); divs1.Append(div2); divs1.Append(div3); divs1.Append(div4); OptimizeForBrowser optimizeForBrowser1 = new OptimizeForBrowser(); webSettings1.Append(divs1); webSettings1.Append(optimizeForBrowser1); webSettingsPart1.WebSettings = webSettings1; }
// Generates content of webSettingsPart1. private void GenerateWebSettingsPart1Content(WebSettingsPart webSettingsPart1) { WebSettings webSettings1 = new WebSettings(); webSettings1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships"); webSettings1.AddNamespaceDeclaration("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main"); Divs divs1 = new Divs(); Div div1 = new Div() { Id = "1081685432" }; BodyDiv bodyDiv1 = new BodyDiv() { Val = true }; LeftMarginDiv leftMarginDiv1 = new LeftMarginDiv() { Val = "0" }; RightMarginDiv rightMarginDiv1 = new RightMarginDiv() { Val = "0" }; TopMarginDiv topMarginDiv1 = new TopMarginDiv() { Val = "0" }; BottomMarginDiv bottomMarginDiv1 = new BottomMarginDiv() { Val = "0" }; DivBorder divBorder1 = new DivBorder(); TopBorder topBorder1 = new TopBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U }; LeftBorder leftBorder1 = new LeftBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U }; BottomBorder bottomBorder1 = new BottomBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U }; RightBorder rightBorder1 = new RightBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U }; divBorder1.Append(topBorder1); divBorder1.Append(leftBorder1); divBorder1.Append(bottomBorder1); divBorder1.Append(rightBorder1); div1.Append(bodyDiv1); div1.Append(leftMarginDiv1); div1.Append(rightMarginDiv1); div1.Append(topMarginDiv1); div1.Append(bottomMarginDiv1); div1.Append(divBorder1); divs1.Append(div1); OptimizeForBrowser optimizeForBrowser1 = new OptimizeForBrowser(); webSettings1.Append(divs1); webSettings1.Append(optimizeForBrowser1); webSettingsPart1.WebSettings = webSettings1; }
public override ProvisioningTemplate ExtractObjects(Web web, ProvisioningTemplate template, ProvisioningTemplateCreationInformation creationInfo) { using (var scope = new PnPMonitoredScope(this.Name)) { web.EnsureProperties( #if !CLIENTSDKV15 w => w.NoCrawl, w => w.RequestAccessEmail, #endif w => w.MasterUrl, w => w.CustomMasterUrl, w => w.SiteLogoUrl, w => w.RootFolder, w => w.AlternateCssUrl, w => w.Url); var webSettings = new WebSettings(); #if !CLIENTSDKV15 webSettings.NoCrawl = web.NoCrawl; webSettings.RequestAccessEmail = web.RequestAccessEmail; #endif webSettings.MasterPageUrl = Tokenize(web.MasterUrl, web.Url); webSettings.CustomMasterPageUrl = Tokenize(web.CustomMasterUrl, web.Url); webSettings.SiteLogo = Tokenize(web.SiteLogoUrl, web.Url); webSettings.WelcomePage = Tokenize(web.RootFolder.WelcomePage, web.Url); webSettings.AlternateCSS = Tokenize(web.AlternateCssUrl, web.Url); template.WebSettings = webSettings; if (creationInfo.PersistBrandingFiles) { if (!string.IsNullOrEmpty(web.MasterUrl)) { var masterUrl = web.MasterUrl.ToLower(); if (!masterUrl.EndsWith("default.master") && !masterUrl.EndsWith("custom.master") && !masterUrl.EndsWith("v4.master") && !masterUrl.EndsWith("seattle.master") && !masterUrl.EndsWith("oslo.master")) { if (PersistFile(web, creationInfo, scope, web.MasterUrl)) { template.Files.Add(GetTemplateFile(web, web.MasterUrl)); } } } if (!string.IsNullOrEmpty(web.CustomMasterUrl)) { var customMasterUrl = web.CustomMasterUrl.ToLower(); if (!customMasterUrl.EndsWith("default.master") && !customMasterUrl.EndsWith("custom.master") && !customMasterUrl.EndsWith("v4.master") && !customMasterUrl.EndsWith("seattle.master") && !customMasterUrl.EndsWith("oslo.master")) { if (PersistFile(web, creationInfo, scope, web.CustomMasterUrl)) { template.Files.Add(GetTemplateFile(web, web.CustomMasterUrl)); } } } if (!string.IsNullOrEmpty(web.SiteLogoUrl)) { if (PersistFile(web, creationInfo, scope, web.SiteLogoUrl)) { template.Files.Add(GetTemplateFile(web, web.SiteLogoUrl)); } } if (!string.IsNullOrEmpty(web.AlternateCssUrl)) { if (PersistFile(web, creationInfo, scope, web.AlternateCssUrl)) { template.Files.Add(GetTemplateFile(web, web.AlternateCssUrl)); } } } var files = template.Files.Distinct().ToList(); template.Files.Clear(); template.Files.AddRange(files); } return template; }
/// <summary> /// Force the server to reload the configuration /// </summary> /// <returns>true if configuration reloaded</returns> public bool ForceServerConfigurationLoad() { WebSettings ws = new WebSettings(); string serverExe = ws.Lookup("ServerExecutable"); Process.Start(serverExe, "/reload-config"); return true; }
// Generates content of webSettingsPart1. private static void GenerateWebSettingsPart1Content(WebSettingsPart webSettingsPart1) { WebSettings webSettings1 = new WebSettings() { MCAttributes = new MarkupCompatibilityAttributes() { Ignorable = "w14 w15" } }; webSettings1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006"); webSettings1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships"); webSettings1.AddNamespaceDeclaration("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main"); webSettings1.AddNamespaceDeclaration("w14", "http://schemas.microsoft.com/office/word/2010/wordml"); webSettings1.AddNamespaceDeclaration("w15", "http://schemas.microsoft.com/office/word/2012/wordml"); Divs divs1 = new Divs(); Div div1 = new Div() { Id = "714617678" }; BodyDiv bodyDiv1 = new BodyDiv() { Val = true }; LeftMarginDiv leftMarginDiv1 = new LeftMarginDiv() { Val = "0" }; RightMarginDiv rightMarginDiv1 = new RightMarginDiv() { Val = "0" }; TopMarginDiv topMarginDiv1 = new TopMarginDiv() { Val = "0" }; BottomMarginDiv bottomMarginDiv1 = new BottomMarginDiv() { Val = "0" }; DivBorder divBorder1 = new DivBorder(); TopBorder topBorder2 = new TopBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U }; LeftBorder leftBorder2 = new LeftBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U }; BottomBorder bottomBorder3 = new BottomBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U }; RightBorder rightBorder2 = new RightBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U }; divBorder1.Append(topBorder2); divBorder1.Append(leftBorder2); divBorder1.Append(bottomBorder3); divBorder1.Append(rightBorder2); div1.Append(bodyDiv1); div1.Append(leftMarginDiv1); div1.Append(rightMarginDiv1); div1.Append(topMarginDiv1); div1.Append(bottomMarginDiv1); div1.Append(divBorder1); divs1.Append(div1); OptimizeForBrowser optimizeForBrowser1 = new OptimizeForBrowser(); RelyOnVML relyOnVML1 = new RelyOnVML(); AllowPNG allowPNG1 = new AllowPNG(); webSettings1.Append(divs1); webSettings1.Append(optimizeForBrowser1); webSettings1.Append(relyOnVML1); webSettings1.Append(allowPNG1); webSettingsPart1.WebSettings = webSettings1; }
/// <summary> /// Create a new user account /// </summary> /// <param name="username"></param> /// <param name="password"></param> /// <returns></returns> public bool CreateUser(string username, string password, bool enabled, bool fileRead, bool fileWrite, bool fileDelete, bool fileAppend, bool dirCreate, bool dirDelete, bool dirList, bool dirSubdirs, bool autoCreate) { WebSettings ws = new WebSettings(); try { // create the new user FilezillaUser fzu = new FilezillaUser(); fzu.Username = username; fzu.Password = password; fzu.Enabled = enabled; // define the user's home directory string homeDir = ws.Lookup("NewUserRoot") + "\\" + username; // create the directory if it doesn't already exist if (!System.IO.Directory.Exists(homeDir)) { System.IO.Directory.CreateDirectory(homeDir); } // create the user's home directory permission FilezillaPermission fzp = new FilezillaPermission(); fzp.Dir = homeDir; fzp.OptionIsHome = true; fzp.OptionFileRead = fileRead; fzp.OptionFileWrite = fileWrite; fzp.OptionFileDelete = fileDelete; fzp.OptionFileAppend = fileAppend; fzp.OptionDirCreate = dirCreate; fzp.OptionDirDelete = dirDelete; fzp.OptionDirList = dirList; fzp.OptionDirSubdirs = dirSubdirs; fzp.OptionAutoCreate = autoCreate; // add the home directory to the user8 fzu.Permissions.Add(fzp); // look up the user in the configuration XmlNode usersNode = config.SelectSingleNode("/FileZillaServer/Users"); XmlNode newUserNode = fzu.Create(config); usersNode.AppendChild(newUserNode); // notify the administrator AccountNotification("Create User", username, password); } catch (Exception) { return false; } return true; }
/// <summary> /// Notify the system administration email address of account information /// </summary> /// <param name="action">action description</param> /// <param name="username">account</param> /// <param name="password">password (unencrypted)</param> /// <returns></returns> protected void AccountNotification(string action, string username, string password) { WebSettings ws = new WebSettings(); string subject = "[FILEZILLA] Account Notification (" + username + ")"; StringBuilder sb = new StringBuilder(); sb.Append( "FileZilla account notification message for the system administrator:\n"); sb.Append( "Action: " + action + "\n" ); sb.Append( "Username: "******"\n"); sb.Append( "Password: "******"\n"); EMail.Send( subject, sb.ToString(), ws.Lookup( "EmailRecipients" ) ); }
// Generates content of webSettingsPart2. private void GenerateWebSettingsPart2Content(WebSettingsPart webSettingsPart2) { WebSettings webSettings2 = new WebSettings(){ MCAttributes = new MarkupCompatibilityAttributes(){ Ignorable = "w14 w15" } }; webSettings2.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006"); webSettings2.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships"); webSettings2.AddNamespaceDeclaration("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main"); webSettings2.AddNamespaceDeclaration("w14", "http://schemas.microsoft.com/office/word/2010/wordml"); webSettings2.AddNamespaceDeclaration("w15", "http://schemas.microsoft.com/office/word/2010/11/wordml"); OptimizeForBrowser optimizeForBrowser2 = new OptimizeForBrowser(); AllowPNG allowPNG2 = new AllowPNG(); webSettings2.Append(optimizeForBrowser2); webSettings2.Append(allowPNG2); webSettingsPart2.WebSettings = webSettings2; }
/// <summary> /// Send the new password notification message /// </summary> /// <param name="username">account</param> /// <param name="password">password (unencrypted)</param> /// <returns></returns> protected void AccountNotification(string username, string password, string recipients) { WebSettings ws = new WebSettings(); string subject = "[FILEZILLA] Password Assignment (" + username + ")"; StringBuilder sb = new StringBuilder(); sb.Append("A new password has been assigned for your " + ws.Lookup("InstanceName" ) + " FileZilla account.\n\n"); sb.Append("Username: "******"\n"); sb.Append("Password: "******"\n"); sb.Append("\n"); sb.Append("Web Interface: " + ws.Lookup("HTTPUrl") + "\n"); sb.Append("FTP Interface: " + ws.Lookup("FTPUrl") + "\n"); // send out notifications only if specified if (recipients.Trim() != "") { // send to the designate recipients EMail.Send(subject, sb.ToString(), recipients); // send to the administrator sb.Append("\nNotifications: " + recipients + "\n"); EMail.Send(subject, sb.ToString(), ws.Lookup("EmailRecipients")); } }
protected void Page_Load(object sender, EventArgs e) { // this page requires an authenticated user Master.ForceAuthentication(); // wire the file manager events FileManager.CustomThumbnail += new FileManagerThumbnailCreateEventHandler(FileManager_CustomThumbnail); FileManager.FileDownloading += new FileManagerFileDownloadingEventHandler(FileManager_FileDownloading); FileManager.FileUploading += new FileManagerFileUploadEventHandler(FileManager_FileUploading); FileManager.FolderCreating += new FileManagerFolderCreateEventHandler(FileManager_FolderCreating); FileManager.ItemDeleting += new FileManagerItemDeleteEventHandler(FileManager_ItemDeleting); FileManager.ItemMoving += new FileManagerItemMoveEventHandler(FileManager_ItemMoving); FileManager.ItemRenaming += new FileManagerItemRenameEventHandler(FileManager_ItemRenaming); // create the configuration related objects webSettings = new WebSettings(); fz = new Filezilla(webSettings.Lookup("ConfigurationFile")); // create the activity related objects log = new ActivityLog(); // get the root folder based on the authenticated user rootFolder = fz.HomeDirectory(Master.UserName); if (!Page.IsPostBack) { // configure the general settings of the file manager FileManager.SettingsEditing.AllowCreate = WebConvert.ToBoolean(webSettings.Lookup("AllowCreate", "0"), false); FileManager.SettingsEditing.AllowDelete = WebConvert.ToBoolean(webSettings.Lookup("AllowDelete", "0"), false); FileManager.SettingsEditing.AllowMove = WebConvert.ToBoolean(webSettings.Lookup("AllowMove", "0"), false); FileManager.SettingsEditing.AllowRename = WebConvert.ToBoolean(webSettings.Lookup("AllowRename", "0"), false); FileManager.SettingsFolders.ShowFolderIcons = WebConvert.ToBoolean(webSettings.Lookup("ShowFolderIcons", "0"), false); FileManager.SettingsToolbar.ShowDownloadButton = WebConvert.ToBoolean(webSettings.Lookup("ShowDownloadButton", "0"), false); FileManager.Settings.ThumbnailFolder = webSettings.Lookup("ThumbnailFolder"); // advanced upload mode requires Microsoft Silverlight ... really? if (Master.IsSilverlightAvailable) { // silverlight is available - check the system configuration to see if we want to utilize it FileManager.SettingsUpload.UseAdvancedUploadMode = WebConvert.ToBoolean(webSettings.Lookup("UseAdvancedUploadMode", "0"), false); FileManager.SettingsUpload.AdvancedModeSettings.EnableMultiSelect = WebConvert.ToBoolean(webSettings.Lookup("EnableMultiSelect", "0"), false); } else { // no silverlight - no advanced upload mode FileManager.SettingsUpload.UseAdvancedUploadMode = false; FileManager.SettingsUpload.AdvancedModeSettings.EnableMultiSelect = false; // if the user could be utilizing silverlight, let them know if (WebConvert.ToBoolean(webSettings.Lookup("UseAdvancedUploadMode", "0"), false)) { SilverlightPanel.Visible = true; } } // set the max file size from the settings, default to 1MB FileManager.SettingsUpload.ValidationSettings.MaxFileSize = WebConvert.ToInt32(webSettings.Lookup("MaxFileSize","1000000"),1000000); // limit permissions based on the settings for the ftp share // disable creating folders if its not enabled in the configuration if (!fz.AllowDirCreate(Master.UserName, rootFolder)) { FileManager.SettingsEditing.AllowCreate = false; } // disable deleting, moving items if its not enabled in the configuration if (!fz.AllowFileDelete(Master.UserName, rootFolder)) { FileManager.SettingsEditing.AllowDelete = false; FileManager.SettingsEditing.AllowMove = false; } // disable upload, move, rename, delete if write is not enabled if (!fz.AllowFileWrite(Master.UserName, rootFolder)) { FileManager.SettingsUpload.Enabled = false; FileManager.SettingsEditing.AllowMove = false; FileManager.SettingsEditing.AllowRename = false; FileManager.SettingsEditing.AllowDelete = false; } // assign the root folder to the user's normalized home directory FileManager.Settings.RootFolder = fz.NormalizeFolderName(rootFolder); // log the browse action log.LogActivity(LogAction.Browse, Master.UserName, FileManager.Settings.RootFolder, "Silverlight=" + WebConvert.ToString( Session["FZNET_SILVERLIGHT"], "false") ); } }
// Generates content of webSettingsPart1. private void GenerateWebSettingsPart1Content(WebSettingsPart webSettingsPart1) { WebSettings webSettings1 = new WebSettings() { MCAttributes = new MarkupCompatibilityAttributes() { Ignorable = "w14 w15 w16se" } }; webSettings1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006"); webSettings1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships"); webSettings1.AddNamespaceDeclaration("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main"); webSettings1.AddNamespaceDeclaration("w14", "http://schemas.microsoft.com/office/word/2010/wordml"); webSettings1.AddNamespaceDeclaration("w15", "http://schemas.microsoft.com/office/word/2012/wordml"); webSettings1.AddNamespaceDeclaration("w16se", "http://schemas.microsoft.com/office/word/2015/wordml/symex"); Divs divs1 = new Divs(); Div div1 = new Div() { Id = "198011547" }; BodyDiv bodyDiv1 = new BodyDiv() { Val = true }; LeftMarginDiv leftMarginDiv1 = new LeftMarginDiv() { Val = "60" }; RightMarginDiv rightMarginDiv1 = new RightMarginDiv() { Val = "60" }; TopMarginDiv topMarginDiv1 = new TopMarginDiv() { Val = "60" }; BottomMarginDiv bottomMarginDiv1 = new BottomMarginDiv() { Val = "15" }; DivBorder divBorder1 = new DivBorder(); TopBorder topBorder90 = new TopBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U }; LeftBorder leftBorder89 = new LeftBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U }; BottomBorder bottomBorder95 = new BottomBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U }; RightBorder rightBorder89 = new RightBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U }; divBorder1.Append(topBorder90); divBorder1.Append(leftBorder89); divBorder1.Append(bottomBorder95); divBorder1.Append(rightBorder89); DivsChild divsChild1 = new DivsChild(); Div div2 = new Div() { Id = "1885019551" }; LeftMarginDiv leftMarginDiv2 = new LeftMarginDiv() { Val = "0" }; RightMarginDiv rightMarginDiv2 = new RightMarginDiv() { Val = "0" }; TopMarginDiv topMarginDiv2 = new TopMarginDiv() { Val = "0" }; BottomMarginDiv bottomMarginDiv2 = new BottomMarginDiv() { Val = "0" }; DivBorder divBorder2 = new DivBorder(); TopBorder topBorder91 = new TopBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U }; LeftBorder leftBorder90 = new LeftBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U }; BottomBorder bottomBorder96 = new BottomBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U }; RightBorder rightBorder90 = new RightBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U }; divBorder2.Append(topBorder91); divBorder2.Append(leftBorder90); divBorder2.Append(bottomBorder96); divBorder2.Append(rightBorder90); div2.Append(leftMarginDiv2); div2.Append(rightMarginDiv2); div2.Append(topMarginDiv2); div2.Append(bottomMarginDiv2); div2.Append(divBorder2); Div div3 = new Div() { Id = "1927107593" }; LeftMarginDiv leftMarginDiv3 = new LeftMarginDiv() { Val = "0" }; RightMarginDiv rightMarginDiv3 = new RightMarginDiv() { Val = "0" }; TopMarginDiv topMarginDiv3 = new TopMarginDiv() { Val = "0" }; BottomMarginDiv bottomMarginDiv3 = new BottomMarginDiv() { Val = "0" }; DivBorder divBorder3 = new DivBorder(); TopBorder topBorder92 = new TopBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U }; LeftBorder leftBorder91 = new LeftBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U }; BottomBorder bottomBorder97 = new BottomBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U }; RightBorder rightBorder91 = new RightBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U }; divBorder3.Append(topBorder92); divBorder3.Append(leftBorder91); divBorder3.Append(bottomBorder97); divBorder3.Append(rightBorder91); div3.Append(leftMarginDiv3); div3.Append(rightMarginDiv3); div3.Append(topMarginDiv3); div3.Append(bottomMarginDiv3); div3.Append(divBorder3); divsChild1.Append(div2); divsChild1.Append(div3); div1.Append(bodyDiv1); div1.Append(leftMarginDiv1); div1.Append(rightMarginDiv1); div1.Append(topMarginDiv1); div1.Append(bottomMarginDiv1); div1.Append(divBorder1); div1.Append(divsChild1); Div div4 = new Div() { Id = "1653750813" }; LeftMarginDiv leftMarginDiv4 = new LeftMarginDiv() { Val = "0" }; RightMarginDiv rightMarginDiv4 = new RightMarginDiv() { Val = "0" }; TopMarginDiv topMarginDiv4 = new TopMarginDiv() { Val = "0" }; BottomMarginDiv bottomMarginDiv4 = new BottomMarginDiv() { Val = "0" }; DivBorder divBorder4 = new DivBorder(); TopBorder topBorder93 = new TopBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U }; LeftBorder leftBorder92 = new LeftBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U }; BottomBorder bottomBorder98 = new BottomBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U }; RightBorder rightBorder92 = new RightBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U }; divBorder4.Append(topBorder93); divBorder4.Append(leftBorder92); divBorder4.Append(bottomBorder98); divBorder4.Append(rightBorder92); div4.Append(leftMarginDiv4); div4.Append(rightMarginDiv4); div4.Append(topMarginDiv4); div4.Append(bottomMarginDiv4); div4.Append(divBorder4); divs1.Append(div1); divs1.Append(div4); OptimizeForBrowser optimizeForBrowser1 = new OptimizeForBrowser(); RelyOnVML relyOnVML1 = new RelyOnVML(); AllowPNG allowPNG1 = new AllowPNG(); webSettings1.Append(divs1); webSettings1.Append(optimizeForBrowser1); webSettings1.Append(relyOnVML1); webSettings1.Append(allowPNG1); webSettingsPart1.WebSettings = webSettings1; }