Hi again,
Isn't it a better idea to create the unique number on submit? How do you know that they will actually be submitting the form? If they don't won't you be left with gaps?
To pass a parameter to InfoPath, my suggestion would be to either a) insert the idea into the XML before opening (via the ASP code) or b) open the form and import (via /aggregate parameter) a simple form with the ID. Yes, you can do this, but I wonder if the design is good (see above paragraph).
The web portal has an empty template.xml. You can ignore this. The ASP will have to create a separate id.xml that is imported into your main form. The ASP will also have to call InfoPath with the /aggregate switch passing the "id.form" as one of the paramters. The id.form just contains the id. You will have to enable merge, extract the XSN and add lines to your importParamters tag in the manifest to instruct it on how to import the id.xml form; you will also have to add the id.xsd as a resource, but shouldn't be too hard. The SDK documents how to use aggregation and I believe there is an MSDN lab on it too. Good luck!
Patrick Halstead [InfoPath MVP]
InfoPathDev
Patrick Halstead
Project Manager at Qdabra