ASP.NET and our lovely Safari

Apparently there are some folks out there that use Safari, I assume most of us ASP geeks are not part of this group (at least until the iPhone come out). Microsoft obviously neither, and ASP.NET does not recognize Safari correctly. For example the asp:Menu does not display right in Safari.

There are tons of posts about this problem, ranging from using BrowserCaps to switching to CSS Adapters.

Browser Caps:
http://slingfive.com/pages/code/browserCaps
Issue here is that Browser Caps are deprecated in ASP.NET 2.0.

CSS Adapters:
http://www.asp.net/CSSAdapters/Default.aspx
Nice solution, but a little bit more time consuming to implement.

Device filters:
http://weblogs.asp.net/dannychen…
Needs browser specific coding.

Browser Definition File:
http://www.big-o.org/?p=20
This is what I used. Simple and effective.

The issue with the Browser Definition File solution is that everybody wrote that one has to change the \windows\framework\v2…\config\browsers\mozilla.browser file and remove the following under the Safari node:

<controlAdapters>
<adapter controlType=”System.Web.UI.WebControls.Menu”
adapterType=”System.Web.UI.WebControls.Adapters.MenuAdapter” />
</controlAdapters>

But nobody mentioned that you actually have to recompile these settings with:

c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regbrowsers.exe -i

And that was it! Problem solved. Boss Happy!

Thanks to Big-O for this hint!




Ähnliche Beiträge


3 Kommentare zu “ASP.NET and our lovely Safari”



  • Saavik am 12. April 2007 11:04 am Uhr

    Thank you for your page titled “ASP.NET and Our Lovely Safari”.
    I have one question:
    While I can change mozilla.browser on my development machine, I could not run aspnet_regbrowsers.exe -i (got error: ASPRUNTIME: Cannot restart W3SVC Service, this operation might require other privileges.) This made no sense since I am administrator 🙁
    At any rate, I do not have access to mozilla.browser on the live server what can I do?
    Your help would be most appreciated.
    Thank you.


  • Remy Blaettler am 20. April 2007 2:46 pm Uhr

    I actually got a new approach from Saavik this morning:

    In Page_PreInit Sub I added these lines:

    Dim s As String
    s = Request.ServerVariables(“http_user_agent”).ToLower
    If s.IndexOf(“safari”) <> -1 Then
    Page.ClientTarget = “uplevel”
    End If

    Good idea if you rent webspace and don’t have access to the server.


  • Chief of the System Blog » Supertext.ch is valid XHTML 1.0 Strict am 26. July 2008 12:36 pm Uhr

    […] had that problem before, when I had to update the CSS MenuAdapter. « ASP Server Variables, Request Object and […]


Leave a Reply

Your email address will not be published. Required fields are marked *



*