Two approaches
Approach 1
1. InfoPath saves out the XML file to the server.
i assume you have the file on the server. you will need to add the account
the asp.net process is running under to the ACL for that folder. this will
allow it to access the file without throwing a permissions exception. it
should be as easy as rightclicking on the folder and selecting read
permissions.
2. When DEFAULT.ASPX is launched, it checks the XML file's timestamp against
an Application Object variable to see if it has changed.
Use the filesystem object for this. the lastaccess(???) property will give
you the file stamp.
3. If the timestamp is different, a call is made to re-transform the XML
Use whatever is available to transform the XSL file. there are a heap of
classes which specialize in transforms. to save you will need write
permissions to the directory. basically it is the same as in step one. you
can use the filesystem object to blast it out to disk
4. DEFAULT.ASPX includes BODY.INC which conains ASPX code. This code will
now be processed because it is just an include.
If the body.inc file is in use by another process, it will throw an
exception so bare that in mind. otherwise it should roll smoothely.
Approach 2
another more elegant approach makes itself apparent. the cache object
contains a dependency function which allows the cache to be updated when a
specific file changes. so, set a cache dependency on the XML file and map it
to a function. when the file changes, the framework calls your function
automatically.
Your function just goes ahead and re-transforms the file and resets the
dependency. here is some code for this approach:
private CacheItemRemovedCallback onRemove = null;
Application_start handler
{
onRemove = new CacheItemRemovedCallback(this.onRemoveReload);
}
functionToRetransform()
{
//retransform your XSL here
// reset the cache dependency using a dummy cache value
HttpContext.Current.Cache.Insert("CUSTOMERLIST", ds, null,
DateTime.Now.AddMinutes(GlobalRateMan.CacheReloadT imeOut),
Cache.NoSlidingExpiration, CacheItemPriority.Normal, onRemove);
}
private void onRemoveReload(String k, Object v, CacheItemRemovedReason r)
{
DataSet ds = new DataSet();
HttpContext.Current.Cache.Insert("CUSTOMERLIST", ds, null,
DateTime.Now.AddMinutes(GlobalRateMan.CacheReloadT imeOut),
Cache.NoSlidingExpiration, CacheItemPriority.Normal, onRemove);
}
The benefit of this approach is that it doesn't have to be in a web page, it
could be a standalone executable or even a webservice. Additionally, the
invalidation retransform happens automatically so you don't need to write
code to manage the file stamp process. let me know if that gets you a step
closer to what you are trying to achieve.
--
Regards,
Alvin Bruney
[ASP.NET MVP
http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here...
http://tinyurl.com/27cok
"Greg Collins [MVP]" <Gr**********@InfoPathDev.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Yes-- that is where I need help. I have the process down in my mind, but am
not sure it will even work, and since my ASP.NET and C# skills are fairly
weak at this point, I need help getting started.
--
Greg Collins [InfoPath MVP]
Please visit:
http://www.InfoPathDev.com
"Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
news:uY**************@TK2MSFTNGP09.phx.gbl...
post the relevant portions of the code please
--
Regards,
Alvin Bruney
[ASP.NET MVP
http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here...
http://tinyurl.com/27cok
"Greg Collins [MVP]" <Gr**********@InfoPathDev.com> wrote in message
news:Oz**************@tk2msftngp13.phx.gbl...
Is there no one who can help with any portion of this?
--
Greg Collins [InfoPath MVP]
Please visit:
http://www.InfoPathDev.com
"Greg Collins [MVP]" <Gr**********@InfoPathDev.com> wrote in message
news:#s**************@TK2MSFTNGP09.phx.gbl...
For background, please refer to my original thread:
http://groups.google.com/groups?selm...tngp13.phx.gbl
I've thought of a potential way around the issue, but I'm new to ASP.NET and
C# and need the expertese of individuals with more experience in these
languages than I have.
I may be completely off target as I thought this up very early in the
morning.
Here's the process as I see it:
1. InfoPath saves out the XML file to the server.
2. When DEFAULT.ASPX is launched, it checks the XML file's timestamp against
an Application Object variable to see if it has changed.
3. If the timestamp is different, a call is made to re-transform the XML
with the associated XSL file, and then save it to the same server folder as
BODY.INC.
4. DEFAULT.ASPX includes BODY.INC which conains ASPX code. This code will
now be processed because it is just an include.
Here's what I need to figure out:
1. How do I get the timestamp of RSS.XML to compare against the Application
Object variable?
2. How do I process the <asp:Xml/> such that it saves to a file named
BODY.INC on the server in the same folder as the DEFAULT.ASPX?
--
Greg Collins [InfoPath MVP]
Please visit:
http://www.InfoPathDev.com