public override object CreateObject(string progID)
 {
     return(_httpServerUtility.CreateObject(progID));
 }
 public void CreateObject_String_Deny_UnmanagedCode()
 {
     hsu.CreateObject(String.Empty);
 }
示例#3
0
 public override object CreateObject(string progID)
 {
     return(_server.CreateObject(progID));
 }
示例#4
0
        private FrontController(HttpServerUtility Server, HttpSessionState Session, Type[] Types, NameValueCollection Configuration, HttpRequest request, HttpResponse response)
        {
            try
            {
                Validate(request);

                this.request  = request;
                this.response = response;

                this.method = request.HttpMethod;
                this.uri    = request.Url.AbsoluteUri;

                string controller = request["controller"];

                Dictionary <String, Object> dict = new MapBuilder(request).getDictionary();

                Type   controllerType   = null;
                object controllerObject = null;

                foreach (Type type in Types)
                {
                    if (type.Name == controller)
                    {
                        controllerType   = type;
                        controllerObject = Server.CreateObject(type);
                    }
                }

                if (controllerType == null)
                {
                    throw new Frame.Exceptions._400();
                }

                MethodInfo myMethod = controllerType.GetMethod(method);

                PropertyInfo myProperty = controllerType.GetProperty("Session");

                myProperty.SetValue(controllerObject, Session, null);

                object obj = myMethod.Invoke(controllerObject, new object[] { dict });

                Session["obj"] = obj;

                TemplateLoader template = new TemplateLoader(Server, Configuration);

                response.Write(template.applyTemplate(obj));
            }
            catch (Exceptions.GenericException ex)
            {
                response.StatusCode = ex.Code;
                response.Write(ex.Message);
            }
            catch (Exceptions.TemplateException ex)
            {
                response.StatusCode = (int)HttpStatusCode.InternalServerError;
                response.Write(ex.Message);
            }
            catch (Exception e)
            {
                response.StatusCode = (int)HttpStatusCode.InternalServerError;
                response.Write(e.Message);
            }
        }