I have been playing around with Mozzila, and find it too be a rather nice speedy browser, but I do ASP.NET programming and such and seem to have some issues with ASP.NET pages displaying properly.

It seems to be with regards to coloring, I guess ASP controls as well
, since those are the things I have colored.


See example code below!

<%@ Page Language="C#" %>
<script runat="server">

    // Insert page code here
    //
    
    void Submit_Click_1&#40;object sender, EventArgs e&#41; &#123;
        if &#40;txtPassword.Text == "test"&#41;
        &#123;
            Session&#91;"UserName"&#93; = txtName.Text;
            //Response.Redirect&#40;"Test.aspx"&#41;;
            Server.Transfer&#40;"Test.aspx"&#41;;
        &#125;
        else
        &#123;
            lblFalse.Text = &#40;"Incorrect Pasword Please try again"&#41;;
        &#125;
    &#125;

</script>
<html>
<head>
</head>
<body>
    <p align="center">
        <asp&#58;Label id="lblHeader" runat="server" head="head" height="25px" width="100%" backcolor="Black" forecolor="White" font-bold="true" text="ASPWEB Login Page" tooltip="Welcome to ASPWEB Login Page">ASPWEB
        Login Page</asp&#58;Label>
    </p>
    <form runat="server">
        <!-- Insert content here -->
        <table cellspacing="15" align="center" sytle="font&#58;10pt verdana;border-width&#58;2;border-style&#58;solid;border-color&#58;black;">
            <tbody>
                <tr>
                    <td>
                        <b>UserName&#58;</b> 
                    </td>
                    <td>
                        <asp&#58;TextBox id="txtName" runat="server"></asp&#58;TextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        <b>Password&#58;</b> 
                    </td>
                    <td>
                        <asp&#58;TextBox id="txtPassword" runat="server" TextMode="Password"></asp&#58;TextBox>
                    </td>
                </tr>
                <tr colspan="2">
                    <td>
                        <asp&#58;Button id="Submit" onclick="Submit_Click_1" runat="server" Text="Submit" Width="77px"></asp&#58;Button>
                    </td>
                </tr>
            </tbody>
        </table>
    </form>
    <div align="center"><asp&#58;Label id="lblFalse" runat="server" width="843px" backcolor="White" font-bold="True" font-size="Medium"></asp&#58;Label>
    </div>
</body>
</html>

Anyone have a solution? Recommendation?

Dani AI

Generated

Brief summary and quick fixes: the rendering differences you see are usually a mix of (1) HTML/typos, (2) relying on ASP.NET control properties that emit browser-dependent attributes, and (3) ASP.NET browser detection (browserCaps) deciding how controls are written. Fix the markup errors first (your table tag has sytle misspelled) and move visual rules into CSS instead of BackColor/ForeColor attributes — that gives every browser the same instructions.

A minimal, practical approach (standards DOCTYPE + CSS classes + server control CssClass):

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<style>
.loginHeader { background:#000; color:#fff; font-weight:bold; padding:6px; width:100%; display:block; text-align:center; }
.inputField { font:10pt Verdana, Arial, sans-serif; width:220px; }
</style>

<asp:Label ID="lblHeader" runat="server" CssClass="loginHeader" Text="ASPWEB Login Page" />
<asp:TextBox ID="txtName" runat="server" CssClass="inputField" />

Browser detection notes and alternatives: as and said, updating browserCaps can help (it controls whether ASP.NET emits DIVs vs TABLEs, tagwriter, etc.), but editing complex regex in web.config is fragile and needs maintenance when browsers change. Safer long-term options are to place .browser files in App_Browsers or use control adapters / consistent CSS so you don't depend on server-side browser sniffing. Test after any change, recycle the app, and clear the browser cache.

Server-side gotcha: your Submit_Click_1 has a stray semicolon after the if — that makes the if do nothing and always run the first block. Fix that logic and prefer clear error text. Finally, test in multiple engines (Mozilla, Safari, IE) with a standards DOCTYPE and external CSS; it will eliminate most color and sizing surprises that noticed.

Recommended Answers

All 5 Replies

Well, I found some of the answer, but still not perfect. (see below). Anyone have any other suggestions?

What I did was add code (xml) to my web.config file in the <system.web> section

<browserCaps>
			<!--NETSCAPE 6 and 7 //-->
			<case match="^Mozilla/5\.0 \&#40;&#91;^&#41;&#93;*\&#41; &#40;Gecko/&#91;-\d&#93;+ &#41;?Netscape&#91;6|7&#93;/&#40;?'version'&#40;?'major'\d+&#41;&#40;?'minor'\.\d+&#41;&#40;?'letters'\w*&#41;&#41;.*">
				tagwriter=System.Web.UI.HtmlTextWriter
				browser=Netscape
				version=$&#123;version&#125;
				majorversion=$&#123;major&#125;
				minorversion=$&#123;minor&#125;
				frames=true
				tables=true
				cookies=true
				javascript=true
				javaapplets=true
				ecmascriptversion=1.5
				w3cdomversion=1.0
				css1=true
				css2=true
				xml=true
			</case>
			<!-- MOZILLA //-->
			<case match="^Mozilla/&#40;?'version'&#40;?'major'\d+&#41;&#40;?'minor'\.\d+&#41;&#40;?'letters'\w*&#41;&#41;.*">
				<case match="^&#91;5-9&#93;\." with="$&#123;version&#125;">
					tagwriter=System.Web.UI.HtmlTextWriter
				</case>
			</case>
			<!--OPERA 5+//-->
			 <case match="Opera&#91; /&#93;&#40;?'version'&#40;?'major'\d+&#41;&#40;?'minor'\.\d+&#41;&#40;?'letters'\w*&#41;&#41;">
		         <filter match="&#91;4-9&#93;" with="$&#123;major&#125;">
				     <filter match="&#91;5-9&#93;" with="$&#123;major&#125;">
			             tagwriter=System.Web.UI.HtmlTextWriter
				     </filter>
	             </filter>
             </case>
		</browserCaps>

browserCaps are the way to go. Thats the same browserCaps section I use for #Portal lol.

Great Tip. It worked perfect for the problem I had with listbox sizes, control placement without html tables (not asp:table) and for textbox sizing (i had already figured out column setting for those though).

Nothing else would have worked except for some table nesting structures for control placement of my asp.net web form.

Thanks a lot.

btw...is there anything for safari? I haven't actually tested it yet, but our graphic designers use Safari exclusively and they would also like to use this web application I'm building.

browserCaps will also fix some of the HTML rendering issues. Panels will render as DIVs instead of Tables, etc. I've been meaning to write an article on browerCaps...

Mozilla will render widths correctly if it comes from the style attribute or a stylesheet.

Cheers,
Steve

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.