ILearnable .Net

December 20, 2006

ASP.NET 2.0 mystical Ambigous match

Filed under: Uncategorized — andreakn @ 01:57

I recently upgraded a website from asp.net 1.1 to asp.net 2.0 “web application project”

Everything worked fine except for one small page that just wouldn’t run, The first line of the aspx file reported an “ambigous match” error, and when I ran the page the same error cropped up.

It turns out that the culprit was a textbox that was defined two times in the codebehind:

protected TextBox txtPostNumber
protected TextBox txtPostnumber

with the only difference being in the casing.
Althought this clearly is fishy code, the second textbox was never used, so no harm done right?
well ASP.NET 1.1 handles this like you would expect, ignoring the other textbox.
ASP.NET 2.0 on the other hand gave me the before mentioned cryptic “ambigous match” error. It turns out that ASP.NET 2.0 acts case-insensitively in this regard.

I wonder why they changed it, and why they can’t give a more useful error message…

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: