While developing and testing locally, I am observing that if my aspx page contains internal css defined within <style>
tag, the page_Load method will execute twice. If I remove it, it executes only once. I've never heard of this and can find no details online of anyone else having this. Seeking insight into this highly bizarre and inconvenient quirk. It applies to any internal css, not just this particular line, and will load twice if <style>
tag is placed anywhere within page (header, body, or footer). Even if blank, the meer presence of <style>
tags causes the page to load twice.
Here is the simplest form of a page that causes the double load:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestSimple.aspx.cs" Inherits="Portal.Web.Main.Portal.SalesTeam.TestSimple" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style>
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
And here's the codebehind
namespace Portal.Web.Main.Portal.SalesTeam
{
public partial class TestSimple : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
System.Diagnostics.Debug.WriteLine("page loading");
}
}
}