When you use asp.net for web development, the information in
Protected override void OnLoad (EventArgs e)
{
/* Add the following dynamically added code here */
Base. OnLoad (e );
}
The following is the dynamically added code.
/* Dynamically Add a style sheet */
HtmlLink link = new HtmlLink ();
Link. Attributes. Add ("type", "text/css ");
Link. Attributes. Add ("rel", "stylesheet ");
Link. Attributes. Add ("href ","~ /Main.css ");
This. Header. Controls. Add (link );
/* Dynamically Add a style */
Style style = new Style ();
Style. ForeColor = System. Drawing. Color. Navy;
Style. BackColor = System. Drawing. Color. LightGray;
This. Header. StyleSheet. CreateStyleRule (style, null, "body ");
/* Dynamically add Meta */
HtmlMeta = new HtmlMeta ();
Meta. Name = "keywords ";
Meta. Content = "Your keywords here ";
This. Header. Controls. Add (meta );
Meta = new HtmlMeta ();
Meta. Name = "company ";
Meta. Content = "microsoft ";
This. Header. Controls. Add (meta );
Meta = new HtmlMeta ();
Meta. Name = "date ";
Meta. Content = DateTime. Now. ToString ("yyyy-MM-dd ");
Meta. Scheme = "YYYY-MM-DD ";
This. Header. Controls. Add (meta );
/* Dynamically add js files */
HtmlGenericControl si = new HtmlGenericControl ();
Si. TagName = "script ";
Si. Attributes. Add ("language", "javascript ");
Si. Attributes. Add ("type", "text/javascript ");
Si. Attributes. Add ("src", "status. js"); // note the path writing method.
This. Page. Header. Controls. Add (si );
In this way, if you view the source code on a page that inherits the BasePage of the base class, you can find that the information added to the head of each page is the same! Haha, isn't that nonsense? It's not the same. It's still useless!
It took me a long time to debug the js Code. All the debugging was successful! It turned out to be a hit when I went to work on Saturday. The problem was solved, so I felt a lot better!
Test environment: vs2005
Self-perception has nothing to do with the test environment. It is estimated that only js file calls may be affected, because the type attribute is rarely written in <script>, if the type attribute is removed from vs2005, a validation error may occur, but the effect and function are not affected!