January 25, 2021
Hot Topics:

Avoiding Annoying Mistakes in Your ASP.NET Web Applications

  • By Jani Järvinen
  • Send Email »
  • More Articles »

However, it is worth noting that the target attribute isn't anymore part of the XHTML "Strict" DTD (Document Type Definition), which implies it will be phased out at some point in the future. Thus, you should try to avoid using it in new web applications, especially if you write XHTML-compatible code.

Furthermore, it is important to remember that the user can click the links in your web applications together with modifier keys. For instance, Internet Explorer 7 and Firefox both support clicking links with the Shift and Ctrl keys pressed down. The former key would open the link in a new window, and the latter in a new tab.

Once the users discover this somewhat hidden feature in their browsers, they generally love it. Unfortunately, many web applications, especially those with heavy, frame-link menu systems, fail to work with the Ctrl key. If this won't work, your users might consider your web application inefficient to use, and could even change to another site.

The lesson is to make sure your web applications work the way users expect. In this case, it is often best to let the user choose, and not choose on their behalf.

Correctly Determine the User's Location

Web applications have become more sophisticated, and the best web sites are able to "guess" the user's place of origin and display content based on that information. For instance, a news web page could display local news based on the user's geographic location.

There are two major ways to do this. Firstly, you could sniff the user's language or locale (often part of the HTTP request fields), or you could purchase a map of IP addresses mapped to geographic locations. For example, MaxMind's GeoIP and GeoLite are products that contain a database that maps IP addresses to countries or even cities.

Although such databases can be great, you should not rely on them one hundred percent. Furthermore, you should always provide the user the option to easily change his or her location information. For example, think a businessman traveling abroad and picking up a hotel WLAN connection. In this case, his IP address would say he is in Berlin, Germany, when he would like to see his local news in London, UK. If the news page would only use the IP address to location mapping as its only source of information, the user could become irritated because the web site tries to be smarter than it actually is.

Similarly, if you are going to detect the user's language, you can use the ASP.NET's Request.UserLanguages array of strings. But even if you do this detection, still let the user choose the language he or she wants to see. It's better to be safe than sorry.


In this article, you looked at small, yet unfortunately common web application mistakes. These mistakes are not actual shop stoppers if your ASP.NET web site is otherwise working correctly, but in the end keeping the users happy should be your main objective.

Although many, many issues could be listed in these kinds of articles, starting with these six problems and fixing them would raise your web site's usability. Then again, it is worth remembering that overall correctness is more important than the little details. But once you get them right, the devil could be in the details.

About the Author

Jani Järvinen is a software development trainer and consultant in Finland. He is a Microsoft C# MVP and has written dozens of magazine articles and published three books about software development. He is a group leader of a Finnish software development expert group at ITpro.fi. His frequently updated blog can be found at http://www.saunalahti.fi/janij/. You can send him mail by clicking on his name at the top of the article.

Page 3 of 3

This article was originally published on June 30, 2008

Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Thanks for your registration, follow us on our social networks to keep up-to-date