Share o=(^.^)=o Point

This site documents a noob's discovery journey on sharepoint portal server 2003. Replace all square brackets ([) with triangle brackets (those used in webscripts).

Tuesday, September 27, 2005

Global.asa and Global.asax

The global file is a file that is placed in the root directory that is always executed before loading any page from this root directory onwards. Global.asa actually runs like any asp script, just that it has standard methods to trigger the execution like session/application start/end. Global.asax is a bit different. There isn't standard session/application start/end methods, and it doesn't run like an asp file. Instead, it runs like an asp.net file. Since sharepoint is using asp.net, you have to put a global.asax file instead of a global.asa file if you plan to use it. Before any .aspx file is loaded from your site, global.asax will be executed.

An example of the global.asax file I created is shown here for noobs like me to get a feel. Seriously, you don't need to know C# to write scripts. You can also use visual basic, which you also don't really need to know. Everything is like english. As long as you have the dictionary, with some grammar rules, you can compose sentences. You can also search for scripts and copy, like how you wrote your first english essay.

[%@ Application ClassName="Globals" language="c#" %]
[%@ Import Namespace="System.Data" %]
[%@ Import Namespace="System.Data.SqlClient" %]
[%@ Import Namespace="System.Web" %]

[SCRIPT language="C#" runat="server"]
protected void Application_MyMethod(Object sender, EventArgs e)
{
...
}

0 Comments:

Post a Comment

<< Home