本文整理汇总了C#中System.Collections.Specialized.NameValueCollection.Remove方法的典型用法代码示例。如果您正苦于以下问题:C# NameValueCollection.Remove方法的具体用法?C# NameValueCollection.Remove怎么用?C# NameValueCollection.Remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Collections.Specialized.NameValueCollection
的用法示例。
在下文中一共展示了NameValueCollection.Remove方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FilterInputParameters
void FilterInputParameters(NameValueCollection inputParameters)
{
inputParameters.Remove("_");
inputParameters.Remove("_q");
inputParameters.Remove("_rm");
inputParameters.Remove("_cmd");
}
示例2: GetNavigationData
public override NameValueCollection GetNavigationData(State state, NameValueCollection data)
{
data[NavigationSettings.Config.PreviousStateIdKey] = data["previous"];
data.Remove("previous");
data.Remove("custom");
return data;
}
示例3: Response
public Response(string resp)
{
_resp = resp;
_nvc = new NameValueCollection();
string[] parts = resp.Split( '&' );
for( int i = 0; i < parts.Length; i++ )
{
string[] ps = parts[i].Split( '=' );
string name = System.Web.HttpContext.Current.Server.UrlDecode( ps[0] );
string value = System.Web.HttpContext.Current.Server.UrlDecode( ps[1] );
_nvc[name] = value;
}
_errors = new List<Error>();
int index = 0;
while(true)
{
if( _nvc["L_ERRORCODE" + index] == null )
break;
var e = new Error() { ErrorCode = _nvc["L_ERRORCODE" + index], ShortMessage = _nvc["L_SHORTMESSAGE" + index], LongMessage = _nvc["L_LONGMESSAGE" + index], SeverityCode = _nvc["L_SEVERITYCODE" + index] };
_errors.Add( e );
_nvc.Remove( "L_ERRORCODE" + index );
_nvc.Remove( "L_SHORTMESSAGE" + index );
_nvc.Remove( "L_LONGMESSAGE" + index );
_nvc.Remove( "L_SEVERITYCODE" + index );
index++;
}
}
示例4: Initialize
public override void Initialize(string name, NameValueCollection config){
if (String.IsNullOrEmpty(name))
name = "WindowsTokenProvider";
if (string.IsNullOrEmpty(config["description"])) {
config.Remove("description");
config.Add("description", SR.GetString(SR.RoleWindowsTokenProvider_description));
}
base.Initialize(name, config);
if (config == null)
throw new ArgumentNullException("config");
_AppName = config["applicationName"];
if (string.IsNullOrEmpty(_AppName))
_AppName = SecUtility.GetDefaultAppName();
if( _AppName.Length > 256 )
{
throw new ProviderException(SR.GetString(SR.Provider_application_name_too_long));
}
config.Remove("applicationName");
if (config.Count > 0)
{
string attribUnrecognized = config.GetKey(0);
if (!String.IsNullOrEmpty(attribUnrecognized))
throw new ProviderException(SR.GetString(SR.Provider_unrecognized_attribute, attribUnrecognized));
}
}
示例5: Initialize
/// <summary>
/// init
/// </summary>
/// <param name="name"></param>
/// <param name="config"></param>
public override void Initialize(string name, NameValueCollection config)
{
if (config == null)
{
throw new ArgumentNullException("config");
}
if (String.IsNullOrEmpty(name))
{
name = "DbBlogProvider";
}
if (String.IsNullOrEmpty(config["description"]))
{
config.Remove("description");
config.Add("description", "Generic Database Blog Provider");
}
base.Initialize(name, config);
if (config["storageVariable"] == null)
{
// default to BlogEngine
config["storageVariable"] = "BlogEngine";
}
this.connStringName = config["storageVariable"];
config.Remove("storageVariable");
if (config["tablePrefix"] == null)
{
// default
config["tablePrefix"] = "be_";
}
this.tablePrefix = config["tablePrefix"];
config.Remove("tablePrefix");
if (config["parmPrefix"] == null)
{
// default
config["parmPrefix"] = "@";
}
this.parmPrefix = config["parmPrefix"];
config.Remove("parmPrefix");
// Throw an exception if unrecognized attributes remain
if (config.Count > 0)
{
var attr = config.GetKey(0);
if (!String.IsNullOrEmpty(attr))
{
throw new ProviderException(string.Format("Unrecognized attribute: {0}", attr));
}
}
}
示例6: Initialize
public override void Initialize(string name, NameValueCollection config)
{
this.mongoCollection = ConnectionHelper.GetDatabase(config).GetCollection(config["collection"] ?? "WebEvents");
config.Remove("collection");
config.Remove("connectionString");
config.Remove("database");
base.Initialize(name, config);
}
示例7: Initialize
public override void Initialize(string name, NameValueCollection config)
{
this.mongoCollection = new MongoClient(config["connectionString"] ?? "mongodb://localhost").GetServer().GetDatabase(config["database"] ?? "ASPNETDB").GetCollection(config["collection"] ?? "WebEvents");
config.Remove("collection");
config.Remove("connectionString");
config.Remove("database");
base.Initialize(name, config);
}
示例8: Initialize
public override void Initialize(string name,
NameValueCollection config)
{
// Verify that config isn't null
if (config == null)
throw new ArgumentNullException("config");
// Assign the provider a default name if it doesn't have one
if (String.IsNullOrEmpty(name))
name = "SimpleMySqlPersonalizationProvider";
// Add a default "description" attribute to config if the
// attribute doesn't exist or is empty
if (string.IsNullOrEmpty(config["description"]))
{
config.Remove("description");
config.Add("description",
"Simple MySql personalization provider");
}
// Call the base class's Initialize method
base.Initialize(name, config);
if (string.IsNullOrEmpty(config["connectionStringName"]))
{
throw new ProviderException
("ConnectionStringName property has not been specified");
}
else
{
m_ConnectionStringName = config["connectionStringName"];
config.Remove("connectionStringName");
}
if (string.IsNullOrEmpty(config["applicationName"]))
{
throw new ProviderException
("applicationName property has not been specified");
}
else
{
m_ApplicationName = config["applicationName"];
config.Remove("applicationName");
}
// Throw an exception if unrecognized attributes remain
if (config.Count > 0)
{
string attr = config.GetKey(0);
if (!String.IsNullOrEmpty(attr))
throw new ProviderException
("Unrecognized attribute: " + attr);
}
}
示例9: Initialize
public override void Initialize(string name, NameValueCollection config)
{
this.mongoCollection = MongoDatabase.Create(
ConfigurationManager.ConnectionStrings[config["connectionStringName"] ?? "MongoConnection"].ConnectionString ?? "mongodb://localhost")
.GetCollection(config["collection"] ?? "WebEvents");
config.Remove("collection");
config.Remove("connectionStringName");
base.Initialize(name, config);
}
示例10: Initialize
public override void Initialize(string name, NameValueCollection settings)
{
var config = DependencyResolver.Current.GetService<IConfig>();
this.mongoCollection = ConnectionUtils.GetCollection(settings, config, "WebEvents");
settings.Remove("collection");
settings.Remove("connectionString");
settings.Remove("database");
base.Initialize(name, settings);
}
示例11: Initialize
////////////////////////////////////////////////////////////
// Public properties
public override void Initialize(string name, NameValueCollection config)
{
if (name == null || name.Length < 1)
name = "AccessProfileProvider";
if (string.IsNullOrEmpty(config["description"]))
{
config.Remove("description");
config.Add("description", "Nada.DA Profile Provider");
}
base.Initialize(name, config);
if (config == null)
throw new ArgumentNullException("config");
_DatabaseFileName = config["connectionStringName"];
if (_DatabaseFileName == null || _DatabaseFileName.Length < 1)
throw new ProviderException("Connection name not specified");
string temp = AccessConnectionHelper.GetFileNameFromConnectionName(_DatabaseFileName, true);
if (temp == null || temp.Length < 1)
{
throw new ProviderException("Connection string not found" + _DatabaseFileName);
}
_DatabaseFileName = temp;
// EDIT GET THE IN MEMORY CONNECTION STRING
_DatabaseFileName = DatabaseData.Instance.AccessConnectionString;
//HandlerBase.CheckAndReadRegistryValue(ref _DatabaseFileName, true);
AccessConnectionHelper.CheckConnectionString(_DatabaseFileName);
_AppName = config["applicationName"];
if (string.IsNullOrEmpty(_AppName))
_AppName = SecUtility.GetDefaultAppName();
if (_AppName.Length > 255)
{
throw new ProviderException("ApplicationName exceeded max length of " + 255);
}
//_Description = config["description"];
config.Remove("connectionStringName");
config.Remove("applicationName");
config.Remove("description");
if (config.Count > 0)
{
string attribUnrecognized = config.GetKey(0);
if (!String.IsNullOrEmpty(attribUnrecognized))
throw new ProviderException("Unrecognized attribute: " + attribUnrecognized);
}
}
示例12: RemoveIgnoredParameters
private void RemoveIgnoredParameters(NameValueCollection parameters, ICollection<string> ignoreList)
{
foreach (string parameterName in ignoreList)
{
parameters.Remove(parameterName);
}
// This is in a somewhat obscure location (mostly used to remove slider filters).
// Maybe I should move this somewhere else?
for (int i = parameters.AllKeys.Length - 1; i >= 0; i--)
{
if (parameters[i].Length == 0)
parameters.Remove(parameters.AllKeys[i]);
}
}
示例13: Initialize
public override void Initialize(string name, NameValueCollection configSettings)
{
if (configSettings == null)
throw new ArgumentNullException("configSettings");
if (string.IsNullOrEmpty(name))
name = "PersonalizationProvider";
if (string.IsNullOrEmpty(configSettings["description"]))
{
configSettings.Remove("description");
configSettings.Add("description", ResourceStringLoader.GetResourceString(
"PersonalizationProvider_Description"));
}
base.Initialize(name, configSettings);
this._applicationName = configSettings["applicationName"];
if (this._applicationName != null)
{
configSettings.Remove("applicationName");
if (this._applicationName.Length > 0x100)
{
object[] args = new object[] { 0x100.ToString(CultureInfo.CurrentCulture) };
throw new ProviderException(ResourceStringLoader.GetResourceString(
"PersonalizationProvider_ApplicationNameExceedMaxLength", args));
}
}
if (!string.IsNullOrEmpty(configSettings["directoryName"]))
this._directoryName = configSettings["directoryName"];
configSettings.Remove("directoryName");
if (!VirtualPathUtility.IsAppRelative(this._directoryName))
throw new ProviderException(ResourceStringLoader.GetResourceString(
"PersonalizationProvider_DirectoryNameNotRelative"));
this._directoryName = VirtualPathUtility.AppendTrailingSlash(this._directoryName);
if (configSettings.Count > 0)
{
string key = configSettings.GetKey(0);
throw new ProviderException(ResourceStringLoader.GetResourceString(
"PersonalizationProvider_UnknownProp", new object[] { key, name }));
}
}
示例14: Initialize
public override void Initialize(string name, NameValueCollection config)
{
// Verify that config isn't null
if (config == null)
throw new ArgumentNullException("config");
// Assign the provider a default name if it doesn't have one
if (String.IsNullOrEmpty(name))
name = "ProductProvider";
// Add a default "description" attribute to config if the
// attribute doesn't exist or is empty
if (string.IsNullOrEmpty(config["description"]))
{
config.Remove("description");
config.Add("description", "SQL Account provider");
}
// Call the base class's Initialize method
base.Initialize(name, config);
// Initialize _connectionString
string connect = config["connectionStringName"];
if (String.IsNullOrEmpty(connect))
throw new ProviderException
("Empty or missing connectionStringName");
config.Remove("connectionStringName");
if (WebConfigurationManager.ConnectionStrings[connect] == null)
throw new ProviderException("Missing connection string");
_connectionString = WebConfigurationManager.ConnectionStrings
[connect].ConnectionString;
if (String.IsNullOrEmpty(_connectionString))
throw new ProviderException("Empty connection string");
// Throw an exception if unrecognized attributes remain
if (config.Count > 0)
{
string attr = config.GetKey(0);
if (!String.IsNullOrEmpty(attr))
throw new ProviderException
("Unrecognized attribute: " + attr);
}
}
示例15: PasswordModelBinderShouldReturnValuesForSpecifiedQueryStrings
public void PasswordModelBinderShouldReturnValuesForSpecifiedQueryStrings()
{
var viewContext = new ViewContext();
viewContext.HttpContext = MockHttpContext.FakeHttpContext();
var appraisalCompanyAdminManagement = Substitute.For<IAppraiserManagement>();
var appraisalCompanyWizardService = Substitute.For<IAppraisalCompanyService>();
var controller = new AppraisalCompanyFeesController(appraisalCompanyWizardService, appraisalCompanyAdminManagement);
controller.SetFakeControllerContext(viewContext.HttpContext);
NameValueCollection queryString = new NameValueCollection();
controller.HttpContext.Request.QueryString.Returns(queryString);
PasswordModelBinder target = new PasswordModelBinder();
var testCases = new[] {
new {QueryStringParameterName="UserChangePasswordViewModel.NewPassword",Value="17"},
new {QueryStringParameterName="CreateUserGeneralInfoViewModel.Password",Value="42"},
new {QueryStringParameterName="Password",Value="2"},
new {QueryStringParameterName="NewPassword",Value="33"},
new {QueryStringParameterName="AppraisalCompanyAdmin.Password",Value="asd"},
new {QueryStringParameterName="GeneralInfo.Password",Value="sssssssssss"},
};
//act
foreach (var testCase in testCases)
{
queryString.Add(testCase.QueryStringParameterName, testCase.Value);
string result = (string)target.BindModel(controller.ControllerContext, new ModelBindingContext());
result.Should().BeEquivalentTo(testCase.Value);
queryString.Remove(testCase.QueryStringParameterName);
}
}