We have all been there before, coding away some HTML and using your favourite browser to check and make sure everything is just right. We then at the end of our coding check the other browsers to make sure they are compliant. What do you know, they all don’t look the same. We have had this happen too many times to count and especially do not enjoy it when it seems it is something out of our control, like ASP.NET controls for example. We have found a way to make ASP.NET controls work they are supposed to across multiple browsers. The way we accomplish this? Browser files.

For those not familiar with browser files they can be create in Visual Studio 2010 under the add new item tab as seen below:

Once you are ready to create the browser file, create the ASP.NET folder App_Browsers folder by right clicking on the website you are working on and choosing Add ASP.NET Folder and then choose it. After added, Right click on the folder and Add a new Browser File from the list of files to choose from. Once the file is created, erase everything and put in the following code.

  <browser refID="safari1plus">
      <adapter controlType="System.Web.UI.WebControls.Menu" adapterType="" />

This code had been worked to make Safari and Chrome compliant with the ASP.NET menu control but other controls that are cross-browser finicky can also be added. We hope this helps those who have been having the troubles we have with ASP.NET menus and if anyone has any tips feel free to leave them in the comments below or Contact Us. Until the next helpful hint, Happy Hacking!

Share This