private static HttpEncoder GetCustomEncoderFromConfig() { HttpRuntimeSection httpRuntime = RuntimeConfig.GetAppConfig().HttpRuntime; Type userBaseType = ConfigUtil.GetType(httpRuntime.EncoderType, "encoderType", httpRuntime); ConfigUtil.CheckBaseType(typeof(HttpEncoder), userBaseType, "encoderType", httpRuntime); return((HttpEncoder)HttpRuntime.CreatePublicInstance(userBaseType)); }
private static RequestValidator GetCustomValidatorFromConfig() { HttpRuntimeSection httpRuntime = RuntimeConfig.GetAppConfig().HttpRuntime; Type userBaseType = ConfigUtil.GetType(httpRuntime.RequestValidationType, "requestValidationType", httpRuntime); ConfigUtil.CheckBaseType(typeof(RequestValidator), userBaseType, "requestValidationType", httpRuntime); return((RequestValidator)HttpRuntime.CreatePublicInstance(userBaseType)); }
private static RequestValidator GetCustomValidatorFromConfig() { // App since this is static per AppDomain RuntimeConfig config = RuntimeConfig.GetAppConfig(); HttpRuntimeSection runtimeSection = config.HttpRuntime; string validatorTypeName = runtimeSection.RequestValidationType; // validate the type Type validatorType = ConfigUtil.GetType(validatorTypeName, "requestValidationType", runtimeSection); ConfigUtil.CheckBaseType(typeof(RequestValidator) /* expectedBaseType */, validatorType, "requestValidationType", runtimeSection); // instantiate RequestValidator validator = (RequestValidator)HttpRuntime.CreatePublicInstance(validatorType); return(validator); }
private static HttpEncoder GetCustomEncoderFromConfig() { // App since this is static per AppDomain RuntimeConfig config = RuntimeConfig.GetAppConfig(); HttpRuntimeSection runtimeSection = config.HttpRuntime; string encoderTypeName = runtimeSection.EncoderType; // validate the type Type encoderType = ConfigUtil.GetType(encoderTypeName, "encoderType", runtimeSection); ConfigUtil.CheckBaseType(typeof(HttpEncoder) /* expectedBaseType */, encoderType, "encoderType", runtimeSection); // instantiate HttpEncoder encoder = (HttpEncoder)HttpRuntime.CreatePublicInstance(encoderType); return(encoder); }