« Previous Next »

Thread: OnGlobalFileChange

Last post 09-10-2008 11:20 AM by anilr. 3 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (4 items)

Sort Posts:

  • 09-09-2008, 7:31 AM

    OnGlobalFileChange

    Hi all. I wanted to write a native IIS7 module that listens to changes of any file within my Web site. So I tried out the GL_FILE_CHANGE notification as it is described in the MSDN (http://msdn.microsoft.com/en-us/library/ms694109.aspx). Everything's fine so far. I do receive the OnGlobalPreBeginRequest notification. But I do not receive any OnGlobalFileChange notification. Maybe I misunderstood the whole thing, but I tried to edit a file within my Web site with the notepad, say "C:\inetpub\MyWebSite\default.html" and I expected to get that notification. But I didn't. Same thing with renaming and copying files. Could anyone help? Thanks, Simon
  • 09-09-2008, 1:03 PM In reply to

    • anilr
    • Top 10 Contributor
    • Joined on 05-23-2006, 10:13 PM
    • Redmond, WA
    • Posts 2,343

    Re: OnGlobalFileChange

    You have to use IHttpServer::RegisterFileChangeMonitor to register for file changes for directories where you want to recieve changes for.  Note that you may sometimes receive changes just because someone else registered for changes using RegisterFileChangeMonitor.

    Anil Ruia
    Senior Software Design Engineer
    IIS Core Server
  • 09-10-2008, 5:03 AM In reply to

    Re: OnGlobalFileChange

    Thanks a lot! That absolutely did the trick! Just one further question. The MSDN says that the parameter "HANDLE hToken" from that function is optional. So what can this parameter do? Simon
  • 09-10-2008, 11:20 AM In reply to

    • anilr
    • Top 10 Contributor
    • Joined on 05-23-2006, 10:13 PM
    • Redmond, WA
    • Posts 2,343

    Re: OnGlobalFileChange

    That is the token for the user you want to register for changes as - otherwise just the process identity is used.

    Anil Ruia
    Senior Software Design Engineer
    IIS Core Server
Page 1 of 1 (4 items)
Microsoft Communities