示例#1
0
        public override void Initialize(string name, NameValueCollection attributes)
        {
            if (_initialized)
            {
                throw new InvalidOperationException(
                          SR.GetString(SR.XmlSiteMapProvider_Cannot_Be_Inited_Twice));
            }

            if (attributes != null)
            {
                if (string.IsNullOrEmpty(attributes["description"]))
                {
                    attributes.Remove("description");
                    attributes.Add("description", SR.GetString(SR.XmlSiteMapProvider_Description));
                }

                string siteMapFile = null;
                ProviderUtil.GetAndRemoveStringAttribute(attributes, _siteMapFileAttribute, name, ref siteMapFile);
                _virtualPath = VirtualPath.CreateAllowNull(siteMapFile);
            }

            base.Initialize(name, attributes);

            if (attributes != null)
            {
                ProviderUtil.CheckUnrecognizedAttributes(attributes, name);
            }

            _initialized = true;
        }
        public override void Initialize(string name, NameValueCollection config)
        {
            string temp = null;

            Debug.Trace("SimpleMailWebEventProvider", "Initializing: name=" + name);

            ProviderUtil.GetAndRemoveStringAttribute(config, "bodyHeader", name, ref _bodyHeader);
            if (_bodyHeader != null)
            {
                _bodyHeader += "\n";
            }

            ProviderUtil.GetAndRemoveStringAttribute(config, "bodyFooter", name, ref _bodyFooter);
            if (_bodyFooter != null)
            {
                _bodyFooter += "\n";
            }

            ProviderUtil.GetAndRemoveStringAttribute(config, "separator", name, ref temp);
            if (temp != null)
            {
                _separator = temp + "\n";
            }

            ProviderUtil.GetAndRemovePositiveOrInfiniteAttribute(config, "maxEventLength", name, ref _maxEventLength);

            base.Initialize(name, config);
        }
示例#3
0
        override public void Initialize(string name, NameValueCollection config)
        {
            Debug.Trace("MailWebEventProvider", "Initializing: name=" + name);

            ProviderUtil.GetAndRemoveRequiredNonEmptyStringAttribute(config, "from", name, ref _from);

            // Read "to", "cc" and "bcc"
            ProviderUtil.GetAndRemoveStringAttribute(config, "to", name, ref _to);
            ProviderUtil.GetAndRemoveStringAttribute(config, "cc", name, ref _cc);
            ProviderUtil.GetAndRemoveStringAttribute(config, "bcc", name, ref _bcc);

            if (String.IsNullOrEmpty(_to) &&
                String.IsNullOrEmpty(_cc) &&
                String.IsNullOrEmpty(_bcc))
            {
                throw new ConfigurationErrorsException(
                          SR.GetString(SR.MailWebEventProvider_no_recipient_error, this.GetType().ToString(),
                                       name));
            }

            ProviderUtil.GetAndRemoveStringAttribute(config, "subjectPrefix", name, ref _subjectPrefix);

            ProviderUtil.GetAndRemoveNonZeroPositiveOrInfiniteAttribute(config, "maxMessagesPerNotification", name, ref _maxMessagesPerNotification);

            ProviderUtil.GetAndRemoveNonZeroPositiveOrInfiniteAttribute(config, "maxEventsPerMessage", name, ref _maxEventsPerMessage);

            _smtpClient = CreateSmtpClientWithAssert();

            base.Initialize(name, config);
        }
示例#4
0
        public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config)
        {
            base.Initialize(name, config);

            _connectionString = ProviderUtil.GetConnectionString(config);

            this.WorldName = ProviderUtil.GetAndRemoveStringAttribute(config, "worldName");

            ProviderUtil.CheckUnrecognizedAttributes(config);
        }
示例#5
0
        public override void Initialize(string name, NameValueCollection config)
        {
            Debug.Trace("SqlWebEventProvider", "Initializing: name=" + name);
            _SchemaVersionCheck = 0;
            string temp = null;

            ProviderUtil.GetAndRemoveStringAttribute(config, "connectionStringName", name, ref temp);
            ProviderUtil.GetAndRemoveStringAttribute(config, "connectionString", name, ref _sqlConnectionString);
            if (!String.IsNullOrEmpty(temp))
            {
                if (!String.IsNullOrEmpty(_sqlConnectionString))
                {
                    throw new ConfigurationErrorsException(SR.GetString(SR.Only_one_connection_string_allowed));
                }

                _sqlConnectionString = SqlConnectionHelper.GetConnectionString(temp, true, true);
                if (_sqlConnectionString == null || _sqlConnectionString.Length < 1)
                {
                    throw new ConfigurationErrorsException(SR.GetString(SR.Connection_string_not_found, temp));
                }
            }
            else
            {
                // If a connection string is specified explicitly, verify that its not using integrated security
                SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder(_sqlConnectionString);
                if (builder.IntegratedSecurity)
                {
                    throw new ConfigurationErrorsException(SR.GetString(SR.Cannot_use_integrated_security));
                }
            }

            if (String.IsNullOrEmpty(_sqlConnectionString))
            {
                throw new ConfigurationErrorsException(SR.GetString(SR.Must_specify_connection_string_or_name, temp));
            }


            ProviderUtil.GetAndRemovePositiveOrInfiniteAttribute(config, "maxEventDetailsLength", name, ref _maxEventDetailsLength);
            if (_maxEventDetailsLength == ProviderUtil.Infinite)
            {
                _maxEventDetailsLength = NO_LIMIT;
            }
            else if (_maxEventDetailsLength > SQL_MAX_NTEXT_SIZE)
            {
                throw new ConfigurationErrorsException(SR.GetString(SR.Invalid_max_event_details_length, name, _maxEventDetailsLength.ToString(CultureInfo.CurrentCulture)));
            }

            ProviderUtil.GetAndRemovePositiveAttribute(config, "commandTimeout", name, ref _commandTimeout);

            base.Initialize(name, config);
        }
 public override void Initialize(string name, NameValueCollection config)
 {
     ProviderUtil.GetAndRemoveBooleanAttribute(config, "buffer", name, ref this._buffer);
     if (this._buffer)
     {
         ProviderUtil.GetAndRemoveRequiredNonEmptyStringAttribute(config, "bufferMode", name, ref this._bufferMode);
         this._webEventBuffer = new WebEventBuffer(this, this._bufferMode, new WebEventBufferFlushCallback(this.ProcessEventFlush));
     }
     else
     {
         ProviderUtil.GetAndRemoveStringAttribute(config, "bufferMode", name, ref this._bufferMode);
     }
     base.Initialize(name, config);
     ProviderUtil.CheckUnrecognizedAttributes(config, name);
 }
 public override void Initialize(string name, NameValueCollection config)
 {
     ProviderUtil.GetAndRemoveRequiredNonEmptyStringAttribute(config, "from", name, ref this._from);
     ProviderUtil.GetAndRemoveStringAttribute(config, "to", name, ref this._to);
     ProviderUtil.GetAndRemoveStringAttribute(config, "cc", name, ref this._cc);
     ProviderUtil.GetAndRemoveStringAttribute(config, "bcc", name, ref this._bcc);
     if ((string.IsNullOrEmpty(this._to) && string.IsNullOrEmpty(this._cc)) && string.IsNullOrEmpty(this._bcc))
     {
         throw new ConfigurationErrorsException(System.Web.SR.GetString("MailWebEventProvider_no_recipient_error", new object[] { base.GetType().ToString(), name }));
     }
     ProviderUtil.GetAndRemoveStringAttribute(config, "subjectPrefix", name, ref this._subjectPrefix);
     ProviderUtil.GetAndRemoveNonZeroPositiveOrInfiniteAttribute(config, "maxMessagesPerNotification", name, ref this._maxMessagesPerNotification);
     ProviderUtil.GetAndRemoveNonZeroPositiveOrInfiniteAttribute(config, "maxEventsPerMessage", name, ref this._maxEventsPerMessage);
     this._smtpClient = CreateSmtpClientWithAssert();
     base.Initialize(name, config);
 }
        public override void Initialize(string name, NameValueCollection config)
        {
            this._SchemaVersionCheck = 0;
            string val = null;

            ProviderUtil.GetAndRemoveStringAttribute(config, "connectionStringName", name, ref val);
            ProviderUtil.GetAndRemoveStringAttribute(config, "connectionString", name, ref this._sqlConnectionString);
            if (!string.IsNullOrEmpty(val))
            {
                if (!string.IsNullOrEmpty(this._sqlConnectionString))
                {
                    throw new ConfigurationErrorsException(System.Web.SR.GetString("Only_one_connection_string_allowed"));
                }
                this._sqlConnectionString = SqlConnectionHelper.GetConnectionString(val, true, true);
                if ((this._sqlConnectionString == null) || (this._sqlConnectionString.Length < 1))
                {
                    throw new ConfigurationErrorsException(System.Web.SR.GetString("Connection_string_not_found", new object[] { val }));
                }
            }
            else
            {
                SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder(this._sqlConnectionString);
                if (builder.IntegratedSecurity)
                {
                    throw new ConfigurationErrorsException(System.Web.SR.GetString("Cannot_use_integrated_security"));
                }
            }
            if (string.IsNullOrEmpty(this._sqlConnectionString))
            {
                throw new ConfigurationErrorsException(System.Web.SR.GetString("Must_specify_connection_string_or_name", new object[] { val }));
            }
            ProviderUtil.GetAndRemovePositiveOrInfiniteAttribute(config, "maxEventDetailsLength", name, ref this._maxEventDetailsLength);
            if (this._maxEventDetailsLength == 0x7fffffff)
            {
                this._maxEventDetailsLength = -1;
            }
            else if (this._maxEventDetailsLength > 0x3fffffff)
            {
                throw new ConfigurationErrorsException(System.Web.SR.GetString("Invalid_max_event_details_length", new object[] { name, this._maxEventDetailsLength.ToString(CultureInfo.CurrentCulture) }));
            }
            ProviderUtil.GetAndRemovePositiveAttribute(config, "commandTimeout", name, ref this._commandTimeout);
            base.Initialize(name, config);
        }
        public override void Initialize(string name, NameValueCollection config)
        {
            // create buffer according to the buffer mode settings specified, like we do in sql/mail providers
            // wire up the delegate to the ProcessEventFlush method
            Debug.Trace("BufferedWebEventProvider", "Initializing: name=" + name);

            ProviderUtil.GetAndRemoveBooleanAttribute(config, "buffer", name, ref _buffer);

            if (_buffer)
            {
                ProviderUtil.GetAndRemoveRequiredNonEmptyStringAttribute(config, "bufferMode", name, ref _bufferMode);
                _webEventBuffer = new WebEventBuffer(this, _bufferMode, new WebEventBufferFlushCallback(this.ProcessEventFlush));
            }
            else
            {
                ProviderUtil.GetAndRemoveStringAttribute(config, "bufferMode", name, ref _bufferMode);
            }

            base.Initialize(name, config);

            ProviderUtil.CheckUnrecognizedAttributes(config, name);
        }
        public override void Initialize(string name, NameValueCollection config)
        {
            string val = null;

            ProviderUtil.GetAndRemoveStringAttribute(config, "bodyHeader", name, ref this._bodyHeader);
            if (this._bodyHeader != null)
            {
                this._bodyHeader = this._bodyHeader + "\n";
            }
            ProviderUtil.GetAndRemoveStringAttribute(config, "bodyFooter", name, ref this._bodyFooter);
            if (this._bodyFooter != null)
            {
                this._bodyFooter = this._bodyFooter + "\n";
            }
            ProviderUtil.GetAndRemoveStringAttribute(config, "separator", name, ref val);
            if (val != null)
            {
                this._separator = val + "\n";
            }
            ProviderUtil.GetAndRemovePositiveOrInfiniteAttribute(config, "maxEventLength", name, ref this._maxEventLength);
            base.Initialize(name, config);
        }
示例#11
0
        public override void Initialize(string name, NameValueCollection config)
        {
            Debug.Trace("TemplatedMailWebEventProvider", "Initializing: name=" + name);

            ProviderUtil.GetAndRemoveStringAttribute(config, "template", name, ref _templateUrl);

            if (_templateUrl == null)
            {
                throw new ConfigurationErrorsException(SR.GetString(SR.Provider_missing_attribute, "template", name));
            }

            _templateUrl = _templateUrl.Trim();

            if (_templateUrl.Length == 0)
            {
                throw new ConfigurationErrorsException(SR.GetString(SR.Invalid_provider_attribute, "template", name, _templateUrl));
            }

            if (!UrlPath.IsRelativeUrl(_templateUrl))
            {
                throw new ConfigurationErrorsException(SR.GetString(SR.Invalid_mail_template_provider_attribute,
                                                                    "template", name, _templateUrl));
            }

            _templateUrl = UrlPath.Combine(HttpRuntime.AppDomainAppVirtualPathString, _templateUrl);

            // VSWhidbey 440081: Guard against templates outside the AppDomain path
            if (!HttpRuntime.IsPathWithinAppRoot(_templateUrl))
            {
                throw new ConfigurationErrorsException(SR.GetString(SR.Invalid_mail_template_provider_attribute,
                                                                    "template", name, _templateUrl));
            }

            ProviderUtil.GetAndRemoveBooleanAttribute(config, "detailedTemplateErrors", name, ref _detailedTemplateErrors);

            base.Initialize(name, config);
        }
 public override void Initialize(string name, NameValueCollection config)
 {
     ProviderUtil.GetAndRemoveStringAttribute(config, "template", name, ref this._templateUrl);
     if (this._templateUrl == null)
     {
         throw new ConfigurationErrorsException(System.Web.SR.GetString("Provider_missing_attribute", new object[] { "template", name }));
     }
     this._templateUrl = this._templateUrl.Trim();
     if (this._templateUrl.Length == 0)
     {
         throw new ConfigurationErrorsException(System.Web.SR.GetString("Invalid_provider_attribute", new object[] { "template", name, this._templateUrl }));
     }
     if (!System.Web.Util.UrlPath.IsRelativeUrl(this._templateUrl))
     {
         throw new ConfigurationErrorsException(System.Web.SR.GetString("Invalid_mail_template_provider_attribute", new object[] { "template", name, this._templateUrl }));
     }
     this._templateUrl = System.Web.Util.UrlPath.Combine(HttpRuntime.AppDomainAppVirtualPathString, this._templateUrl);
     if (!HttpRuntime.IsPathWithinAppRoot(this._templateUrl))
     {
         throw new ConfigurationErrorsException(System.Web.SR.GetString("Invalid_mail_template_provider_attribute", new object[] { "template", name, this._templateUrl }));
     }
     ProviderUtil.GetAndRemoveBooleanAttribute(config, "detailedTemplateErrors", name, ref this._detailedTemplateErrors);
     base.Initialize(name, config);
 }