Пример #1
0
        protected override void OnPreInit(EventArgs e)
        {
            if (Request != null && Request["ASP.NET.COMPILE.ONLY"] == "true")
            {
                Response.Write("Compiled successfully.");
                Response.End();
            }

            ProcessSSL();

            EnforceSecurity();

            if (StartupControl != null)
            {
                ClientScript.RegisterStartupScript(GetType(), "Set startup focus", "$(document).ready(function(){$(" +
                                                   StartupControl.ForBrowser() + ").focus();});", addScriptTags: true);
            }

            if (WebTestManager.IsSanityExecutionMode())
            {
                ClientScript.RegisterStartupScript(GetType(), "Adapt for Sanity",
                                                   WebTestManager.GetSanityAdaptorScript(), addScriptTags: true);
            }

            base.OnPreInit(e);
        }
Пример #2
0
        /// <summary>
        /// Initializes the <see cref="T:System.Web.UI.HtmlTextWriter"/> object and calls on the child controls of the <see cref="T:System.Web.UI.Page"/> to render.
        /// </summary>
        /// <param name="writer">The <see cref="T:System.Web.UI.HtmlTextWriter"/> that receives the page content.</param>
        protected override void Render(HtmlTextWriter writer)
        {
            if (InsertCommonResourcesEnabled)
            {
                InsertCommonResources();
            }

            ReferenceRegisteredScripts();

            var originalPath = Context.Items["ORIGINAL.REQUEST.PATH"] as string;

            if (originalPath.HasValue())
            {
                Context.RewritePath(originalPath);
            }

            //  NeatCssTagManager.RenderPage(base.Render, writer);
            base.Render(writer);

            // if (HttpApplication.TempDatabaseInitiated == false) throw new Exception("FALSE!!");
            // if (HttpApplication.TempDatabaseInitiated == null) throw new Exception("NULL!!");

            if (WebTestManager.IsTddExecutionMode() &&
                Request.FilePath.EndsWith(".aspx", StringComparison.OrdinalIgnoreCase) &&
                !IsCallback && !Request.IsAjaxCall())
            {
                writer.Write(WebTestManager.GetWebTestWidgetHtml(Request));
            }
        }
Пример #3
0
        protected override void OnBeginRequest()
        {
            base.OnBeginRequest();

            if (ClearAppleAdapters())
            {
                if (Request.UserAgent?.Contains("AppleWebKit") ?? false)
                {
                    Request.Browser.Adapters.Clear();
                }
            }

            var path = Request.GetRelativePath();

            if (path == "/KeepAlive.ashx")
            {
                Response.EndWith("Kept alive");
            }

            // Backwards compatibility:
            if (path == "/tasks.ashx" && WebTestManager.IsTddExecutionMode())
            {
                WebTestManager.DispatchTasksList();
            }

            ProcessPagesFolderPrefix(path);
        }
Пример #4
0
 protected virtual void OnBeginRequest()
 {
     WebTestManager.AwaitReadiness();
     if (Request["Web.Test.Command"] == "Sql.Profile")
     {
         var file = MSharp.Framework.Data.DataAccessProfiler.GenerateReport(Request["Mode"] == "Snapshot");
         Response.EndWith("Report generated: " + file.FullName);
     }
     else
     {
         WebTestManager.ProcessCommand(Request["Web.Test.Command"]);
     }
     ProcessInjectedFiles();
 }
Пример #5
0
 static void InitiateApplication()
 {
     // The constructor is called more than once.
     if (AlreadyInitiated)
     {
         return;
     }
     else
     {
         AlreadyInitiated = true;
     }
     WebTestManager.InitiateTempDatabase(enforceRestart: false, mustRenew: false);
     LookForInsecureFiles();
 }
Пример #6
0
 void ProcessInjectedFiles()
 {
     if (!WebTestManager.IsTddExecutionMode())
     {
         return;
     }
     if (Request.Files == null || Request.Files.Count == 0)
     {
         return;
     }
     foreach (var key in Request.Form.AllKeys.Where(k => k.EndsWith("_InjectedContents")))
     {
         var fileKey = key.TrimEnd("_InjectedContents");
         Request.Files.InjectFile(fileKey, Convert.FromBase64String(Request.Form[key]), Request.Form[fileKey + "_InjectedFileName"], "application/octet-stream");
     }
 }
Пример #7
0
        protected virtual void InitiateApplication()
        {
            // The constructor is called more than once.
            if (AlreadyInitiated)
            {
                return;
            }
            else
            {
                AlreadyInitiated = true;
            }

            // initializations
            SessionMemory.Initialize(new SessionMemoryAccessor());
            ApplicationEventManager.Initialize(new DefaultApplicationEventManager());
            EmailService.Initialized(new EmailServiceConfigurator());
            Services.Globalization.Translator.Initialize(new Services.Globalization.CookiePropertyHelper());
            MSharpExtensions.ToFullMessageExtendedTypeChecking.Add(HttpUnhandledExceptionToFullMessageAction);

            MSharp.Framework.Context.Initialize(new DefaultServiceProvider());

            WebTestManager.InitiateTempDatabase(enforceRestart: false, mustRenew: false);
            LookForInsecureFiles();
        }