Any solid help for "Item has already been added. Key in dictionary: 'RegEx' Key being added: 'RegEx'"

524 views
Skip to first unread message

MorningZ

unread,
Mar 5, 2007, 10:04:45 AM3/5/07
to UrlRewritingNet
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(ProviderBase
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

Albert Weinert

unread,
Mar 5, 2007, 3:29:38 PM3/5/07
to UrlRewr...@googlegroups.com
--- 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: UrlRewr...@googlegroups.com [mailto:UrlRewr...@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'"

Glyn

unread,
May 4, 2007, 4:54:58 AM5/4/07
to UrlRewritingNet
Will this be rolled into version 2.1??

Thanks

Albert Weinert

unread,
May 4, 2007, 7:50:36 AM5/4/07
to UrlRewr...@googlegroups.com
Yes, something like that.

-----Ursprüngliche Nachricht-----
Von: UrlRewr...@googlegroups.com [mailto:UrlRewr...@googlegroups.com] Im Auftrag von Glyn
Gesendet: Freitag, 4. Mai 2007 10:55
An: UrlRewritingNet
Betreff: [UrlRewritingNet] Re: AW: [UrlRewritingNet] Any solid help for "Item has already been added. Key in dictionary: 'RegEx' Key being added: 'RegEx'"

rtw...@gmail.com

unread,
Jul 3, 2007, 1:38:25 AM7/3/07
to UrlRewritingNet
Thanks for the fix albert.


On May 4, 9:50 pm, "Albert Weinert" <albert.wein...@awn-design.biz>
wrote:


> Yes, something like that.
>
> -----Ursprüngliche Nachricht-----
> Von: UrlRewr...@googlegroups.com [mailto:UrlRewr...@googlegroups.com] Im Auftrag von Glyn
> Gesendet: Freitag, 4. Mai 2007 10:55
> An: UrlRewritingNet

> Betreff: [UrlRewritingNet] Re: AW: [UrlRewritingNet] Any solid help for "Itemhasalreadybeenadded.Keyindictionary: 'RegEx'Keybeingadded: 'RegEx'"

Reply all
Reply to author
Forward
0 new messages