Geeks With Blogs

Igor Milovanović .NET, cats and more...

Just a quick copy'n'paste of few code lines you might find usefull:

How to stream InfoPath document dynamically to the browser (e.g. from database) :

Create an empty page (you can create a HttpHandler as well):

Add following four lines to the Page_Load event.

Context.Response.ContentType = "application/ms-infopath.xml";
Context.Response.AddHeader("content-disposition", "attachment; give_your_infopath_document_a_cool_name_here.xml");
Context.Response.BinaryWrite( Encoding.UTF8.GetBytes (yourInfoPathDocumentAsXmlStringGoesHere));
Context.Response.End();

Remember to use the proper Encoding class.  

[1] http://geekswithblogs.net/drewby/archive/2004/01/15/1322.aspx

Posted on Tuesday, January 17, 2006 6:14 PM .NET | Back to top


Comments on this post: Stream InfoPath Document Dynamically to the Browser

# re: Stream InfoPath Document Dynamically to the Browser
Requesting Gravatar...
Igor,

When I look at the IIS logs after InfoPath as downloaded an form data XML file (not the template but the data), I see InfoPath makes 3 GET requests when I expect just one.

Do you know what is happening?

Cheers,
Michael Herman
m w herman at parallelspace period net
Left by Michael Herman (Parallelspace) on Jan 18, 2006 2:23 AM

# re: Stream InfoPath Document Dynamically to the Browser
Requesting Gravatar...
Infopath tries for some strange reason to reload the document from the URL on it's own... this behaviour is described in the comments to the original post...Don't know the exact reason yet...
Left by Igor Milovanovic on Jan 20, 2006 5:37 PM

# re: Stream InfoPath Document Dynamically to the Browser
Requesting Gravatar...
were you able to find the solution to avoid InfoPath makes 3 GET request ?
Left by NAT on Jul 31, 2006 2:22 PM

# re: Stream InfoPath Document Dynamically to the Browser
Requesting Gravatar...
When IP opens, I get a msgbox "readonly".
How can this be avoided ?

Chris
Left by Chris on Feb 26, 2007 1:19 PM

Your comment:
 (will show your gravatar)


Copyright © Igor Milovanovic | Powered by: GeeksWithBlogs.net