--- UrlRewritingProviderCollection.cs
using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration.Provider;
namespace UrlRewritingNet.Configuration.Provider
{
public class UrlRewritingProviderCollection : ProviderCollection
{
private object lockObject = new object();
public override void Add(ProviderBase provider)
{
if (provider == null)
throw new ArgumentNullException("provider");
if (!(provider is UrlRewritingProvider))
{
string msg = string.Format("Provider must implement type {0}", typeof(UrlRewritingProvider).ToString());
throw new ArgumentException(msg, "provider");
}
lock (lockObject)
{
if (base[provider.Name] == null)
{
base.Add(provider);
}
}
}
public void CopyTo(UrlRewritingProvider[] providers, int index)
{
lock (lockObject)
{
base.CopyTo(providers, index);
}
}
new public UrlRewritingProvider this[string name]
{
get
{
return (UrlRewritingProvider)base[name];
}
}
}
}
-----Ursprüngliche Nachricht-----
Von: UrlRewritingNet@googlegroups.com [mailto:UrlRewritingNet@googlegroups.com] Im Auftrag von MorningZ
Gesendet: Montag, 5. März 2007 16:05
An: UrlRewritingNet
Betreff: [UrlRewritingNet] Any solid help for "Item has already been added. Key in dictionary: 'RegEx' Key being added: 'RegEx'"
This error happens now and then during Application Start, a simple
page refresh solves the issue, but that's all great and fine when it's
me that's kicking off the start, but i'd hate for a client to run
across this.....
Server Error in '/' Application.
--------------------------------------------------------------------------- -----
Item has already been added. Key in dictionary: 'RegEx' Key being
added: 'RegEx'
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.ArgumentException: Item has already been
added. Key in dictionary: 'RegEx' Key being added: 'RegEx'
Source Error:
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of
the exception can be identified using the exception stack trace
below.
Stack Trace:
[ArgumentException: Item has already been added. Key in dictionary:
'RegEx' Key being added: 'RegEx']
System.Collections.Hashtable.Insert(Object key, Object nvalue,
Boolean add) +2834883
System.Collections.Hashtable.Add(Object key, Object value) +11
System.Configuration.Provider.ProviderCollection.Add(ProviderBase
provider) +75
UrlRewritingNet.Configuration.Provider.UrlRewritingProviderCollection.Add(P roviderBase
provider) +40
UrlRewritingNet.Web.UrlRewriting.Initialize() +181
UrlRewritingNet.Web.UrlRewriting.CreateRewriteRule(String
providerName) +13
UrlRewritingNet.Web.UrlRewriteModule.Init(HttpApplication context)
+217
System.Web.HttpApplication.InitModules() +267
System.Web.HttpApplication.InitInternal(HttpContext context,
HttpApplicationState state, MethodInfo[] handlers) +1251
System.Web.HttpApplicationFactory.GetNormalApplicationInstance(HttpContext
context) +243
System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext
context) +106
System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr)
+214