Using the ExecuteUrl element in ONET.XML

There's a little-known child element of the <Configuration> element in ONET.XML called "ExecuteUrl". This URL is called once a site is created.
The ExecuteUrl element is used in an ONET.XML file to specify the URL that is called following instantiation of the site definition. This can be used if you need to do something programmatically to the site when it is created.

For example :
1).Create a LookUp field in a list, this can not de done in the Site Definition and will have to be done manually or programmatically after the site is created.
2).Change the theme programmatically.

Using the ExecuteUrl element
The ExecuteUrl parameter is located in the Configuration section in ONET.xml file. From the above given examples I a demonstrating example number 2. i.e Change the theme programatically.
Step 1: Specify the ExecuteUrl parameter in the ONET.xml file. Within this element add an attribue called “Url” that defines the URL that is called following instantiation of the site definition.
example : Here is what my element looks like (more or less). The ExecuteUrl element is in red.

'<'Configuration ID="1" Name="DemoSite"'>'
'<'List Title="Shared Documents" Url="Shared Documents" QuickLaunchUrl="Shared Documents/Forms/AllItems.aspx" Type="101"/'>'
'<'Module Name="DemoModule"/'>'
'<'Module Name="WebPartPopulation"/'>'
'<'ExecuteUrl Url="_layouts/DemoSite/DemoPage.aspx?QueryParam=theme"/'>'

Step 2: This will usually point to an ASPX page but if the page is blank and you call code in the Page_Load event then you can perform the processing you need. Just remember to redirect back to the home page of your site when you are finished.

SPWeb thisWeb = SPControl.GetContextWeb(Context);
///Place your code here
Response.Redirect (thisWeb.Url);

Note : The ExecuteUrl element only works for Team Site Templates. It only works for Meeting Workspace and Document Workspace templates when the sites are created from the Create function in Sharepoint. The ExecuteUrl element is also ignored if a Meeting Workspace is created from Microsoft Outlook 2003.