June 2010 - Posts - Jimmy Rishe

InfoPath Dev

Jimmy Rishe

June 2010 - Posts

  • WebDav Security and WebDav on IIS 6.0

    Last week I blogged about setting up WebDav on IIS 7.0+, so that you can take advantage of qRules' useful SaveToSharePoint command even if you don't have SharePoint.

    This week, I would like to touch very briefly on the matter of security and provide some quick pointers on using WebDav on IIS 6.0, if that is what your web server is running.


    First, security.

    As with installing any new service on a server, there are risks to keep in mind when setting up WebDav.  WebDav, by its nature, is designed to make it easier to read and write files from and to your web server, so you naturally want to make sure only the right people are doing the right things.  Once you have gone through the simple setup steps to get SaveToSharePoint to work, it's important to tighten down security to the tightest restrictions that will work for you.

    The following web page deals with security on WebDav.  It is geared towards IIS 6.0, but the same concepts should apply to other versions as well.



    Now, about using WebDav on IIS 6.0.

    My previous post went into a moderate amount of detail for the setup steps, because I was unable to locate a thorough tutorial for setting up WebDav on IIS 7.0 and above.  Luckily, one has already been written for IIS 6.0:


    Once you have installed WebDav on your server, create a virtual directory for your files, similarly to the way I described in my earlier blog post.   In the Virtual Directory tab of the virtual folder's properties, just enable Read, Write, and (if desired) Directory browsing.  Click ok to save the changes, and you should be all set to test out the feature.

    Virtual Folder Properties

  • Saving Forms as New to DBXL

    Typically when you open a form from DBXL and re-submit it, your modified form will be saved on top of the one you opened.  This is a very useful feature, and undoubtedly what you want to do most of the time, but sometimes you will want to save a new copy of a form and leave the original one unchanged.  This short tutorial will teach you how to do that.

    The DBXL PI

    When you open a form from DBXL, the form's XML will have an XML Processing Instruction (PI) embedded in it.  This PI contains the form's DocId, and some other information, and when you re-submit the form, DBXL reads this and knows which form to overwrite.

    Therefore, if you remove this PI, DBXL will treat the form as a new document, and will save it as a new form, instead of overwriting the original.  Below are two methods for removing this PI.

    Using qRules

    qRules includes a command to remove the DBXL PI from an XML form. Just use this simple command:


    Using Code

    If you would prefer to use code, you can use the following short snippet to locate the DBXL PI, and remove it if it is present:

    const string piXPath = "/processing-instruction()[name() = 'QdabraDBXL']";
    XPathNavigator pi = MainDataSource.CreateNavigator().SelectSingleNode(piXPath);

    if (pi != null)

    Once you have used one of the two above methods, your form should be submitted as a new document the next time you submit it.

  • Using qRules' SaveToSharePoint Command Without SharePoint

    qRules provides a handy command called SaveToSharePoint, that allows you to save attachments in your InfoPath forms to a SharePoint server, to reduce the size of your XML forms, and allow these files to be accessed without opening up your forms in InfoPath.

    But in spite of its name, you don't have to have SharePoint to take advantage of this command. Using a module called WebDAV, it's possible to configure an ordinary IIS website to allow files to be saved to it.  This tutorial goes through a few simple steps for setting up WebDAV, to accept files saved via the SaveToSharePoint command.

     This tutorial assumes the three following requirements:

    • You will be saving the files to a server running Windows Vista, Windows Server 2008, or Windows 7
    • You already have an IIS website running on your server
    • Your website uses Windows authentication

    Without further ado, here's how to set up a file repository where you can save your files.

    1.  Ensure you have WebDAV installed on your server.

    Open up IIS manager, and in the Connections pane, expand the Sites folder and click the node for your website.

    A number of icons should be shown in the center of IIS Manager.  Look in the IIS section of this group of icons and look for an icon called WebDAV Authoring Rules.  If this icon is present, please skip to Step 2.

    If you see no WebDAV Authoring Rules icon, you will need to install or enable WebDAV.  Please consult the corresponding Installing WebDAV section of the following page to get WebDAV setup on your server.  Vista and Windows Server 2008 users should consult the section for IIS 7.0.  Windows 7 users should consult the section for IIS 7.5.


    Once you have installed WebDAV, please close and reopen IIS manager, and ensure that the WebDAV Authoring Rules icon is available now.

    2.  Create a virtual folder for your saved files.

    Since you don't want to allow users to save files just anywhere on your site, the next step is to create a virtual folder where files can be saved to your site.  Right-click your site's node in the Connections pane, and select Add Virtual Directory...

    Give the virtual directory a name (this is the subdirectory of your site where files will be saved), and create and/or select a physical folder on the hard disk to which this folder will correspond.  Click OK.

    3.  Enable WebDAV on the new virtual folder.

    Select your site again in the Connections pane, and double-click the WebDAV Authoring Rules icon.  Click the Enable WebDAV text in the Actions pane to the right to enable WebDAV for the site.

    Now, select your new virtual folder in the Connections pane so that the top of the center pane says FolderName Home, where FolderName is the name of your new folder.

    Double-click the WebDAV Authoring Rules icon again.  Now click the Add Authoring Rule... text in the Actions pane to create a rule to allow saving and accessing files in this virtual directory.  For simplicity, just add a simple rule that allows Read, Write, and Source, for all content and all users.  Click OK.  You have now set up your virtual directory to use WebDAV.

    4.  Set up an index for your virtual folder.

    One last step to allowing SaveToSharePoint to work on your site is to set up an index for your new virtual directory.  By default, IIS prevents making requests directly to folders on a site, and this will cause SaveToSharePoint to not work.  You have options.

    a.  If you would like users to be able to see a list of the files in the folder using a browser

    Again select your new virtual folder in the Connections pane of IIS Manager.

    Double click the Directory Browsing icon in the IIS section of the central pane.

    Click the Enable text in the Actions pane.

    b.  If you do not want users to see a list of the files in the folder

    Open a new instance of Notepad

    Without entering any text, save the file with the name index.htm in the physical disk location that corresponds to your virtual directory

    This will cause a blank page to be displayed if anyone navigates to this directory in a browser.  If you like, you can instead use a file with HTML, to display a certain page to users who navigate to that directory.


    If the above went successfully, you should now be able to use the SaveToSharePoint qRules command to save InfoPath attachments to your site.  Just specify the URL to your virtual folder in the command's url parameter:

    SaveToSharePoint /url=http://intranet.site/InfoPathSaveFiles/ /xpath=/my:myFields/my:files/my:file

    Best of luck!

Copyright © 2003-2018 Qdabra Software. All rights reserved.
View our Terms of Use.