InfoPath cannot find form - IE Bug? - InfoPath Dev
in

InfoPath Dev

InfoPath cannot find form - IE Bug?

Last post 08-16-2007 04:36 PM by Shiraz Cupala. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 08-25-2006 02:49 AM

    • ivl
    • Not Ranked
    • Joined on 08-25-2006
    • Posts 12

    InfoPath cannot find form - IE Bug?

    Hi folks,

    Please could you help me with a problem that I haven't been able to solve.

    I have an ASP.NET 2.0 website, which reads data from a database and creates an InfoPath form out of it. This data is needed to pre-populate the InfoPath form with required data.

    The form template is located on a SharePoint form library on a different server.

    In the ASP.NET 2.0 website, when the user clicks a button, I use the following code to send him the form:

    Dim bytes() As Byte = Encoding.UTF8.GetBytes(myDataSet.GetXml())
    Response.Expires = 0
    Response.Cache.SetNoStore()
    Response.Clear()
    Response.AddHeader("Content-Disposition", "attachment; filename=MyFile.infopathXml")
    Response.ContentType = "application/ms-infopath.xml"
    Response.AppendHeader("Pragma", "no-cache")
    Response.Charset = ""
    Dim formTemplate As String = ProfileCommon.Properties("TemplateLocation").DefaultValue
    Dim formVersion As String = ProfileCommon.Properties("TemplateVersion").DefaultValue
    Response.Write("<?xml version=""1.0"" encoding=""UTF-8""?>")
    Response.Write("<?mso-infoPathSolution solutionVersion=""" & formVersion & """ href=""" & formTemplate & """ productVersion=""11.0.8034"" PIVersion=""1.0.0.0"" ?>")
    Response.Write("<?mso-application progid=""InfoPath.Document""?>" & vbCrLf)
    Response.BinaryWrite(bytes)
    Response.End()


    Starting with FireFox, everything works as expected - the user is prompted to open or save the file and in both instances the form opens successfully, with the pre-populated data.

    With Internet Explorer (tested with IE6 and IE7 beta), if the user selects 'Open' when he is prompted to open or save the file, InfoPath opens up and gives me this error:
    quote:
    InfoPath cannot open the following file: MyFile[1].infopathXml.
    InfoPath cannot find or cannot access the following file: C:\Documents and Settings\User\Local Settings\Temporaty Internet Files\Content.IE5\6DKFEL25\MyFile[1].infopathXml


    If the user rather chooses to save the file and then open it, everything works as it should.

    Why can't the form be opened from the Temporary Internet Files? Why does this only occur in IE? I don't want the user to go through so many clicks to open the form (Save, choose location, navigate to location, double click, etc) - I want them to just click Open and InfoPath opens up. Even better, can I eliminate the 'Open or Save' dialog from appearing alltogether?

    Any help would be appreciated.

    Edit: I'm using InfoPath 2003
  • 08-25-2006 04:20 AM In reply to

    • ivl
    • Not Ranked
    • Joined on 08-25-2006
    • Posts 12

    Re: InfoPath cannot find form - IE Bug?

    Right, I finally figured out what the problem was.

    Notice that the above code disables caching of the response? Turns out that the file was automatically getting deleted BEFORE InfoPath could open it. Firefox seems to behave differently.

    Taking out all of the lines of code related to the disabling of caching fixed my problem.

    My last question still remains though, is there any way of automatically launching InfoPath without first displaying an 'Open or Save' dialog in the browser?
  • 08-16-2007 04:36 PM In reply to

    Re: InfoPath cannot find form - IE Bug?

    To avoid this issue entirely you should use the technique described in the following post to link to your files: http://www.infopathdev.com/blogs/shiraz/archive/2007/08/16/best-way-to-launch-forms-from-web-pages.aspx

    Shiraz Cupala / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.