Ejemplo n.º 1
0
        // Must have constructor with this signature, otherwise exception at run time
        public AspHandler(RequestDelegate next)
        {
            _scriptCache = new Dictionary <string, CompiledPage>();
            AspHostConfiguration config = new AspHostConfiguration();

            _aspHost = new AspHost(config);
        }
Ejemplo n.º 2
0
        public AspHost(AspHostConfiguration config)
        {
            _config = config;

            ScriptRuntimeSetup setup = new ScriptRuntimeSetup();

            if (config != null && config.Trace)
            {
                setup.Options["Trace"] = ScriptingRuntimeHelpers.True;
            }

            string qualifiedname = typeof(VBScriptContext).AssemblyQualifiedName;

            setup.LanguageSetups.Add(new LanguageSetup(
                                         qualifiedname, "vbscript", new[] { "vbscript" }, new[] { ".vbs" }));
            _runtime = new ScriptRuntime(setup);
            if (config != null && config.Assemblies != null)
            {
                foreach (Assembly a in config.Assemblies)
                {
                    _runtime.LoadAssembly(a);
                }
            }
            _engine = _runtime.GetEngine("vbscript");
        }