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