Ambiguous match found

Looks like I've been away a few months. Sorry 'bout that. I've had stuff to write about but not enough time to set aside to do so, which is a little ironic; one of the main reasons I created this blog was so I could take 5 minutes and jot down stuff I find out while developing, largely in case it helps others, not so I could write my usual verbose 5000 word essays (which is what my AspAlliance site is for!).

So, on that note, I wanted to share how I solved a goofy error that made no sense. I was upgrading a good-sized web application from .NET 1.1/Visual Studio 2003 to .NET 2.0/Visual Studio 2005 using Scott Guthrie's well-written instructions and the Web Application Projects add-in. Going through VS2005's automatic conversion and building it was pretty painless when I followed Scott's instructions; one wrinkle I ran into is that it forgot about the three web projects, so I had to add those manually using "Add Existing Project" after I converted the others.

But it built and I went through the app and everything was fine. I didn't do the "Convert to Web Application" command on the whole project, preferring to keep a closer eye on what it changed, and touch it up after. So I started doing it folder by folder per Step 8 inScott's instructions, and it seemed to work great, until I got to one particular page and got this error.

Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Ambiguous match found.

Source Error:

Line 1:  <%@ Control language="c#" Inherits="MyApp.Namespace.MyCoolControl" CodeBehind="
MyCoolControl.ascx.cs" AutoEventWireup="false" %>
Line 2:  <%@ Import Namespace="
MyApp.OtherNamespace" %>
Line 3:  <div class="openingParagraph">

Source File: /MyApp/Namespace/
MyCoolControl.ascx    Line: 1

So it says Line 1, Line 1 is highlighted, and yet, the only reference in line 1 is a fully-qualified one. To be safe, I pulled all my custom assemblies into the invaluable .NET Reflector and double-checked, and there was only one instance of that class name anywhere.

I tried what I normally try when I get weird ASP.NET errors I shouldn't be getting, a process many of you are probably too familiar with if you've worked with ASP.NET very long. I restarted IIS, deleted and recreated the application in IIS Manager, deleted the Temporary ASP.NET Files directory for MyApp (after closing Visual Studio), restarted Visual Studio and rebuilt the project, etc. None of these helped this time.

Scott's instructions mentioned this error in some cases, notably the IE WebControls, but the solution has been to specify the full namespace, not just the class name, so that didn't help me. Other Google search results were similarly unhelpful, until I found the blog of a guy named Eran Sandler who talked about his "Ambiguous match found" error and how he solved it--two protected fields with names that differed only in case, apparently confusing reflection.

Sure enough, my code had the same problem--I had myRepeaterControl (name changed to protect the innocent, of course), and MyRepeaterControl in my code-behind. The latter wasn't used and was probably left in mistakenly; I removed it, it still built fine, and the control worked great.

Thanks, Eran!

Published Friday, August 11, 2006 1:31 PM by pjohnson
Filed under: ,


# re: Ambiguous match found

Hi There Peter.

I'm glad that my post helped you solve the problem :-)

It's always nice to see that something I write about in the blog eventually help real people in real situations.

Sunday, August 20, 2006 3:53 AM by Eran Sandler

# re: Ambiguous match found

Hi, I had the same problem. It turned out to be a different resolution: The web site was configured for .NET 2.0 instead of .NET 1.1 (as the case for this old project). Changed it in IIS Settings (ASP.NET tab) and fixed. May help someone else.

Tuesday, August 22, 2006 3:42 AM by Matt

# re: Ambiguous match found

Thank you so much, this definitely helped end my frustration with this problem!  Only wish I could have found it sooner!  :)

Tuesday, August 22, 2006 12:00 PM by Natalie

# re: Ambiguous match found

Sure saved me many hours. Thanks!

Thursday, August 24, 2006 5:11 PM by Chris Mohrbacher

# re: Ambiguous match found

This really helped thanku.

Tuesday, September 19, 2006 11:38 AM by uz

# re: Ambiguous match found

Thanks! Saved us lots of time, too. One more thing of note: it doesn't seem to matter that the two similarly named fields both be protected. I changed one of mine to private -- it no longer needed the protected scope anyway -- but that did'nt help. Only by giving them different names did the page work.

Tuesday, September 26, 2006 4:55 PM by Rich Armstrong

# re: Ambiguous match found

Thanks Peter for clarifying this head-scratcher. It really saved me a bunch of time.

Thursday, November 9, 2006 12:56 PM by Tibor Biro

# re: Ambiguous match found

Fabulous - you've saved my bacon.

Wednesday, November 15, 2006 7:33 AM by Paul Robinson

# re: Ambiguous match found

Thank's Peter... this one stumped me till I just ran across your blog.

Thursday, November 30, 2006 4:31 PM by Mike M

# re: Ambiguous match found

Thankyou. That solved my issue too, I renamed my private variables, redeployed and it worked.  

Wednesday, December 13, 2006 4:17 AM by Happy Coder

# re: Ambiguous match found

I run into the similar problem. I found the solution reading you blog. I post my owner intro. Thank you !

Wednesday, January 24, 2007 2:29 PM by gbulfon

# re: Ambiguous match found

thanks,  i have the same problem.

Tuesday, February 27, 2007 1:04 AM by shanghai

# re: Ambiguous match found

Thank's Peter, I'd been scratching my head for ages with this problem until I found this blog. 30 seconds later the issue was fixed. Just in time too, the software is being released to a customer tomorrow.

Tuesday, February 27, 2007 7:18 AM by Scott

# re: Ambiguous match found

how did you guys find the similarly named controls?

Wednesday, March 14, 2007 4:19 PM by DarthFahza

# re: Ambiguous match found

This solved my problem, thanks!

Tuesday, April 24, 2007 10:40 AM by AndyC

# re: Ambiguous match found

Changing the IIS settings helped, thanks a bunch :) We have two environments going one on 2.0 and one on 1.1 and someone must have switched the 1.1 to 2.0 by accident, this saved me hours.

Friday, May 4, 2007 5:21 PM by KathyF

# re: Ambiguous match found

Thanks a lot, it was great that i found the solution atlast through your blog. Great work.

Monday, May 7, 2007 12:06 AM by Bhakee

# re: Ambiguous match found

MUCH appreciated!

I thought for sure my IIS was screwed up - until I got the same error on another machine.  Got smart and found your post - thanks for taking the time to put this kind of info up!

Monday, May 7, 2007 9:25 PM by TDriver

# re: Ambiguous match found


I don't have time to dig into it much right now, but it makes sense that you're solving the same problem/cause a different way. I got the error when dynamic compilation (on MyCoolControl.ascx) ran into a naming conflict, and you skipped dynamic compilation by compiling it all ahead of time. Offhand though, I'm not sure why you wouldn't get the error during build/publish (which I believe does the tasks done during dynamic compilation, just ahead of time).


Thursday, May 10, 2007 3:06 PM by pjohnson

# re: Ambiguous match found

I checked the all the naming of control placed on the web page.I found one protected  asp:textbox control has similar name(Role) with the private string role.I changed the Role to txtRole.And a dynamic asp:label created twice in my page.I removed one of the dynamically created label control.It fixed my problem

Thanks a lot for the information provided on this blog.

Thursday, May 10, 2007 4:20 PM by vinod parnati

# re: Ambiguous match found

I had this problem when uploading a .net v1.1 app to v2.0 hosting.  I set the hosting to v1.1 and the problem was solved.

Monday, May 21, 2007 9:14 AM by Darren

# re: Ambiguous match found

Thanks. It helped me to solve my problem

Tuesday, June 26, 2007 5:42 AM by nitesh

# re: Ambiguous match found

Brilliant, saved me a lot of time. Thanks.

Wednesday, July 18, 2007 12:08 PM by Nev

# re: Ambiguous match found

I found this error when I have my webservice installed in ver 1.1 in a different pool and my application in ver 2.0 in a different pool

Monday, July 23, 2007 9:16 AM by Ganesh

# re: Ambiguous match found

I used the "Allow this precompiled site to be updated" advice above and this fixed the problem for me. This is a great relief because the page I was having the issue with has some 50 controls on it. I could compile and run this page locally without error, but when deployed I would get the runtime error "Ambigous Match Found". This kind of cr@p drives me nuts, so glad there was an easy fix!

Tuesday, July 24, 2007 12:52 PM by Jeff

# re: Ambiguous match found

Thanks for this post, saved me loads of time!

Friday, July 27, 2007 10:17 AM by Barry

# re: Ambiguous match found

Thanks Martin Bell! VS found it easily with the 'Convert to web application'.

Monday, September 10, 2007 9:07 AM by Pia Nilsson

# re: Ambiguous match found

Had the same issue with UserControls, showing up as ambigous name. Any Ideas ?

Monday, October 8, 2007 3:09 PM by shiv

# re: Ambiguous match found

I tried the following trick and it works. Thanks.

re: Ambiguous match found

Hi, I had the same problem. It turned out to be a different resolution: The web site was configured for .NET 2.0 instead of .NET 1.1 (as the case for this old project). Changed it in IIS Settings (ASP.NET tab) and fixed. May help someone else.

Tuesday, October 9, 2007 5:01 PM by Jane

# re: Ambiguous match found

Thanks for the solution and also thanks for the Hans Kesting tip.

Friday, October 12, 2007 2:14 AM by vk

# re: Ambiguous match found

Thanks a lot Peter. Your post helped solve my problem very quickly.

I also liked the following tip:

"Thursday, October 11, 2007 4:55 AM by Hans Kesting"

Monday, October 15, 2007 8:36 AM by karthick

# re: Ambiguous match found

Thank You very much Peter. You know it helped me a lot, coz I wasted lot of time in fixing this error but all gone in vain. I once again thank you.

Wednesday, October 24, 2007 11:11 AM by Saleem

# re: Ambiguous match found

Rockin!  The twenty second solution to what I dreaded would have been a killer...

Wednesday, November 14, 2007 9:49 AM by Matthew

# re: Ambiguous match found

It's the problem with ASP.NET version

Saturday, December 1, 2007 2:40 AM by Kannan

# re: Ambiguous match found

Thanks! This solved my problem as well!

Wednesday, January 16, 2008 5:37 PM by xigam

# re: Ambiguous match found

Thank you very very much, I had the problem where a private variable had the same name as a control i.e bool btnhelp and WebControl BtnHelp and it only happened on a .net 2.0 website, 1.1 did not complain

Wednesday, January 30, 2008 2:03 PM by fran

# re: Ambiguous match found

Thanks very much for this info, i had a dropdownlist on a page with the name GroupList, which clashed with an object in the code behind page called groupList

Thursday, January 31, 2008 6:40 AM by Mike

# re: Ambiguous match found

Thx a lot Your'e a coding time saviour ;-)

Monday, February 18, 2008 2:36 AM by Chaos

# re: Ambiguous match found

This was a great post. Saved me heaps of time. The error itself is terrible though.

Tuesday, March 4, 2008 10:20 PM by Anil

# re: Ambiguous match found

I had the same error. Had a hard time finding it since the name with variant case was distributed in the aspx and code behind.  

Thanks a bunch! Saved me a lot of time...

Wednesday, March 5, 2008 12:39 PM by Sven

# re: Ambiguous match found

WOW!!! Thanks! Saved us lots of time,

Sunday, March 30, 2008 8:21 PM by niusha

# re: Ambiguous match found


This came up as the first item in my google...

Read it... THought Hmmmmmm....

Went to my members drop down in the ide, and slowly scrolled down... and there it was same name just cased differently!!!! changed the one variable name and POW!!  running like a champ!!!!!!!

THANK YOU !!!!!!!!!!!!!!!!!!!

Monday, May 5, 2008 1:03 PM by BillyDvd

# re: Ambiguous match found

Thanks So Much!  Maybe the error should be changed to Ambiguous Error Message Found, just to make things clear :-}

Unfortunately Eran Sandler's blog is gone, but the duplicate name issue is also what i had.

Thanks Again!


Thursday, June 5, 2008 12:29 PM by Bill

# re: Ambiguous match found

My version of the problem was that the wrong level of .net was specified for the app (2.x instead of the correct one, 1.x.  It would have taken me a long time to figure that out, without the help here.  Thanx.

Thursday, June 12, 2008 10:23 PM by Mike K

# re: Ambiguous match found

Easiest way to find the case mismatches is just try "Convert to Web Application" on that particular page, .NET designer will show you the variable name! :)



Tuesday, June 17, 2008 5:20 AM by Manohar

# re: Ambiguous match found

Thanks for your kind information

Monday, October 13, 2008 10:50 AM by SatS

# re: Ambiguous match found

Thank u man. Good solution .

Wednesday, November 5, 2008 8:49 AM by Kumar

# re: Ambiguous match found

Hah.. I remember doing this before, thanks for the memory.. I just did it again! DOH

Thanks..I am such a bonehead

Thursday, November 13, 2008 1:46 PM by Jeff

# re: Ambiguous match found

Worked for me too, thanks!

Tuesday, November 18, 2008 11:22 AM by Chris

# re: Ambiguous match found

What worked for me was running

aspnet_regiis -r

in the WINDOWS\Microsoft.NET\Framework\v* folder for the appropriate version of .NET to update script maps.  I did not have to change any code.  My problem was evidently due to running an older version of my application that needed v1.1.4322 while v2.0.50727 was still installed (left over from a previous run with a newer version).

Wednesday, November 26, 2008 11:42 AM by Tom Godfrey

# re: Ambiguous match found

Thanks a lot, it's works great !

Monday, December 1, 2008 7:53 PM by Filimindji

# re: Ambiguous match found

Thank you sooooo much.

That's the bad things of copy-pasting code without even changing it at least to your style / coding standards. argghhh....

Sunday, December 21, 2008 9:02 PM by Thodoris

# re: Ambiguous match found

so sad ...the blog had been removed... Dunno how to solve it now

Friday, December 26, 2008 1:58 AM by Goober

# re: Ambiguous match found


Sure enough, Eran Sandler's blog is gone.

But read my post carefully--the problem is having two variables with the same name differing only by case, like myRepeaterControl and MyRepeaterControl. You solve it by removing/renaming one of them to a "more distinct" name.


Sunday, December 28, 2008 11:23 AM by pjohnson

# re: Ambiguous match found

Thanks a lot! Worked like a charm.

Monday, January 12, 2009 6:46 PM by Karen

# re: Ambiguous match found

Thanks for this.  In my case I'm pretty sure that the conversion tool itself generated the error.  If it gave a warning i either missed or ignored it :-)  I had a control on the .aspx page differing in case from the C# class.  I suspect the tool added the ASP control to the designer class, then failed to match and remove it from the original C# class file, leaving two ambiguous controls.   I had to binary chop the ASP to locate the offending control, but afterwards I realised that a careful reading of the class in Object browser would have found the "duplicate".  Woudl have been nice if the error message had *named* the ambiguous control :-)

Wednesday, March 11, 2009 12:41 PM by John A Fotheringham

# re: Ambiguous match found

Sehr wertvolle Informationen! Empfehlen!

Saturday, March 14, 2009 12:39 AM by ...

# re: Ambiguous match found

I solved the error by returning to .NET Framework 1.1 of which the aplication was written for.

Friday, April 3, 2009 12:13 PM by E. Burlan

# re: Ambiguous match found

You and Evan are kings among men!! Luckily your page was the second one I checked after having this problem!! Thanks!

Friday, April 3, 2009 11:46 PM by Chris

# re: Ambiguous match found

Even thou my problem was the same the solution of it was different. In my case it was returning the infamous error because I named a column in my table (SQL Server 2005) as being "Tag". It looks like that the parser was making confusion while running my .netTiers application. I renamed it to "Description" and it worked out.


Monday, April 6, 2009 3:07 PM by Juba

# re: Ambiguous match found

Thanks for this wonderful blog.. It instantly solved my problem. The problem occured whicle publishing the web site , there was an unused hidden field that was specified with the same name as of the string variable in codebeind.

I removed the hidden variable and now its working... Thanks again...

Tuesday, April 14, 2009 4:54 AM by Shikha Kalyan

# re: Ambiguous match found

Almost three years old, and yet this post continues to save people (myself included) from hours of frustrating wild goose chases.  Thank you both, Peter and Eran!

Friday, May 8, 2009 11:55 AM by Steve

# re: Ambiguous match found

Hey ...thanks for the post, I had the same problem after migrating an web app from 1.1 version to 2.0. After reading this blog, i checked my code and yes i found variables with same name ,but differed in case.Hope Microsoft will have a look at this issue and makes a better compiler

Tuesday, May 12, 2009 10:08 AM by Pravin

# re: Ambiguous match found

Great post! You solved my issue caused migration from .net 1.1 to .net 2 in a webapps.

Also I had 2 variables with the same name, but different case. Now it works perfectly.

It is a very absurd bug, I would have never solved it alone...

Thank you

Tuesday, May 19, 2009 11:24 AM by Giorgio T

# re: Ambiguous match found

Bless you. You probably saved me an entire day of troubleshooting.

Thursday, July 23, 2009 12:58 PM by Josh

# re: Ambiguous match found

Many thanks Peter - this little gem saved me a lot of hassle :)

Thursday, July 30, 2009 9:28 AM by Darren B

# re: Ambiguous match found


now it's working again ^^

Monday, August 10, 2009 9:05 AM by unkown

# re: Ambiguous match found

Thanks a lot, this helped me, i was frustrated with this problem. Thanks once again. keep up the good work.


Thursday, October 15, 2009 10:09 AM by Ahmed

# re: Ambiguous match found

You sir solved my problem.


Thursday, October 15, 2009 11:16 AM by Mathlec

# re: Ambiguous match found

Thank you so much... I know this is an older post, but this saved me more insanity than you will ever know.  God Bless You, Sir.

Thursday, October 15, 2009 3:33 PM by SBasham

# re: Ambiguous match found

Please check ur site may be mapped with wrong framework.

Monday, November 30, 2009 4:50 AM by Aman

# re: Ambiguous match found


Thanks for the updated URL! I've updated the post accordingly.


Thursday, December 10, 2009 5:44 PM by pjohnson

# re: Ambiguous match found


My fix was resolved by Unchecking "Allow this precompiled site to be updated" through Publish Web Site.

Thanks a ton for the help.

Friday, May 7, 2010 4:47 AM by Sunil Raheja

# re: Ambiguous match found


I'm glad I've come across this page. It helped me figure out where the issue was because the error didn't always occur.

For me I was inheriting an object and also defining properties with the same name.

Thanks. You saved my day.

Wednesday, May 26, 2010 4:50 AM by Felician Balint

# re: Ambiguous match found

Thanks. it work like a magic on me.. thanks alot

Thursday, May 27, 2010 4:22 AM by Rencie Bautista

# re: Ambiguous match found


Thanks for the kind words! And for the note about the Visual Studio warning. It sounds like they've updated VS to detect when you're going to get this vague error before you actually get it, a decent "band aid" warning short of what I would consider a "true" fix of making the error message more helpful. What version of Visual Studio are you using?


Thursday, May 27, 2010 8:46 PM by pjohnson

# re: Ambiguous match found

Helped me solve my problem.

It turned out I defined a drop-down list named Country on aspx. On the aspx.cs, I was busy copy/pasting and I accidentally declared it as

protected System.Web.UI.WebControls.TextBox Country

Once I changed it to DropDownList, error went away.

Tuesday, June 29, 2010 6:59 PM by Joel

# re: Ambiguous match found

This helped me so much.  The solutions I was finding on other pages were wrong for my problem.  Once I saw your solution, everything clicked!

Thursday, July 1, 2010 9:56 AM by Vicky

# re: Ambiguous match found

thanks for the soln..

i tried to find it hard and found one protected variable that too, Form1 , with differnt case in the two files :$

Tuesday, July 13, 2010 2:48 AM by charu

# re: Ambiguous match found

Thanks a lot! It was one day of work to find out that it was due to 1.1 code running in 2.0 version in iis. But it was giving issue only in one page. When I changed to 1.1 it worked for me but the real issue was having two same named labels declaration with case mismatch.

Tuesday, July 13, 2010 12:25 PM by Amrita

# re: Ambiguous match found

Thanks Martin Bell.  I spent an entire day correcting case-sensitive markup errors.  I knew my problem was in the markup, but could not figure out what control was causing it.  Your post make the most sense.  That was a cool trick and it fixed my problem.

Thursday, January 20, 2011 2:24 PM by rrlevron

# re: Ambiguous match found

Bingo!  Your post is almost 5 years old and is still helping people!  How the heck  you figured out the cause of the issue in the first-place with that completely useless error message is beyond me.  This could have cost me a couple days of head-scratching, easy.

Hat's off and thank-you!

Tuesday, April 5, 2011 2:53 PM by Jon Swoveland

# re: Ambiguous match found

Thank u, Peter. and thanks a lot to Eran.

You guys are life saving..

Monday, June 20, 2011 12:39 PM by ankith83

# re: Ambiguous match found

Thanks Man

It Save My Lot of time

Tuesday, September 6, 2011 1:47 AM by Amit

# re: Ambiguous match found

I have the same problem but does not have such case sensitive issue as explained above. Still struggling :(

Thursday, September 15, 2011 9:31 AM by vikas.khanna03

# re: Ambiguous match found

Thanks. This helped me in identifying the same issue I faced in my page.

Friday, September 30, 2011 11:42 AM by lmuthu

# re: Ambiguous match found

Awesome Post!!

Saved me a lot of searching and frustrating moments.

Thanks a million Peter!!

Wednesday, February 8, 2012 4:43 AM by girijaa

# re: Ambiguous match found

My fix was resolved by Unchecking "Allow this precompiled site to be updated" through Publish Web Site.  Uploaded code to production server and everything worked fine.

Wednesday, February 8, 2012 12:27 PM by satheesh

# re: Ambiguous match found

I've the same problem and it solved and the solution is in check your code behind and you will find a couple of Controls with the same name:

protected Button Home;

protected System.Web.UI.HtmlControls.HtmlAnchor home;

you have to erase one line or comment it.

thanks a lot.

Saturday, April 21, 2012 5:54 AM by Abd ul Aziz Kasem and Mohamed Ali

# re: Ambiguous match found

Thanks we always need your help

Friday, May 11, 2012 6:19 AM by thanks

# re: Ambiguous match found

I had same problem, but by following your post, i Commented all code and checked step by step and found the names of the session and global variable were same, after changing them its working now :)

Thursday, July 26, 2012 12:45 AM by Sooraj

# re: Ambiguous match found

Wow, that was exactly the problem.. Thanks a ton Peter! Really saved a lot of time :)

Monday, March 11, 2013 4:22 PM by Janhavi

# re: Ambiguous match found


Thursday, October 24, 2013 1:16 PM by authentic for cheap

# re: Ambiguous match found

I changed

 <uc3:success ID="success1" runat="server" />


 <uc3:success ID="Success1" runat="server" />

and my form worked!

You probably just saved me an hour of debugging!

Thank you!

Tuesday, December 3, 2013 7:29 AM by Ulf Lunde

# re: Ambiguous match found

It is nice compose, No later than this shaire that for my frinds.

Wednesday, December 25, 2013 4:06 AM by

# re: Ambiguous match found

These days of austerity plus relative panic about incurring debt, lots of people balk contrary to the idea of making use of a credit card to make acquisition of merchandise or even pay for a vacation, preferring, instead to rely on a tried as well as trusted way of making payment - cash. However, if you've got the cash there to make the purchase completely, then, paradoxically, that's the best time for them to use the cards for several reasons.

Monday, December 30, 2013 4:22 PM by supra hf 1440

# re: Ambiguous match found

I literally just got done painting my backsplash galapagos turquoise.  I think that means I will, in fact, have to kill someone to get that desk.  Seriously.  I got a guy. ;)

Tuesday, March 11, 2014 9:25 PM by cheap ray ban aviator

Leave a Comment