Asp.Net Menu not rendering correctly in Google’s Chrome

March 21, 2009

Thought I’d make a quick blog post on this as it’s issue that took me a while to work out.


Basically if you use a ASP:Menu control in your Web application this might not render correctly in certain browsers, most notably Google’s Chrome. In addition to the physical appearance when clicking on a menu option the entire menu disappeared.


This is caused by .net not determining the capabilities of certain browsers and as a consequence renders the menu with just the basic of features.


To solve this you will need to tell .net the capabilities of the browser. For .net 2.0 & above  you need to create a new browers file with the capabilities and upload it to your server.

  1. In VS2008 Solution Explorer right click your application and add the “ASP.Net Folder” App_Browsers if you don’t already have it.
  2. Add a New “Browser File” item to this special folder and call it safari.browser (if fixing the problem for Chrome)
  3. Delete all the default stuff VS put in this file and replace it with the following:
      <browser refID=”safari1plus”> 
          <adapter controlType=”System.Web.UI.WebControls.Menu” adapterType=”” /> 
  4. Save your file & test locally to see if all is well.
  5. Now for the annoying bit. Upload the new app_browser folder & file to your production server, if you have used the “copy web site” menu option to upload or sharepoint or frontpage, these will create a new folder under app_browsers called vti_cnf
  6. Manually delete the vti_cnf folder under app_browser on your production server. If you don’t you’ll get “Parse error: Data at the root level is invalid. Line 1, position 1.” in your new safari.browser file.
  7. Remember to manually delete this vti_cnf folder everytime you make a change to the app_browser folder or contained files.  

So there you go, how to solve the control rendering problems with Google’s Chrome.

If you found this information useful, send me an email and let me know or even better still visit my website and buy something it would be appreciated. I’ve got loads of software to send and receive SMS . And while you’re there try out the menu structure as it’s all working now.