Welcome to Office Zealot Sign in | Join | Help

Julie's Office Dev Blog

Sorta like yoga... just less flexible.
XmlFormViewer In ASP.NET Application

In my zeal to be on the bleeding edge of technology, I'm taking an ASP.NET application that was using custom ASPX pages for UI requirements and am looking into having that UI done in InfoPath 2007.  With the new (and what sounds cool) feature of being able to host InfoPath forms in the browser, I thought it would solve a revolving problem we have that requires a “developer” to create new ASPX pages for each template we want to automate.  InfoPath is much more intuitive for a non-developer to use and as long as my app can get the return data, it's a really great solution to what has been a headache for a number of years.

I've spent the better portion of two days trying to make this work.  The first requirement of using the XmlFormViewer is that you must develop your application on the same machine as your Forms Server (ie., Office Server).  I don't know any developer that keeps their dev engine on their server and I'm still hoping this requirement is just a pre-RTM requirement but, nonetheless, I decided the easier route was to install Office Server on my development box rather than installing the dev engine on my test lab and having to keep my code over there.  After getting past the various error message, installation issues (since I had Office 12 on here previously as well as SQL Server) and getting Office Server installed, I then set about to figuring out how to just get my custom apps to run under a box with Office Server on it.  This wasn't necessarily the easiest task I've taken on lately!

A second requirement of using the XmlFormViewer is that you cannot cross domains to access an XSN.  This meant that my custom app had to reside in the same domain.  I tried many, many things to get this to work with little success.  If you look in IIS after an Office Server installation you'll see plenty of VDs for Sharepoint.  Office Server configuration shows you a bazillion ports.  Finally this afternoon it all came together with some help from the InfoPath team and, Office Zealot's own (okay pre-own but whatever), Charles Maxson.

1.  Using IIS Manager find the default WSS VirtualDirectory (this may always be Sharepoint(80), I don't know... I have 4 other Sharepoint(port#) in IIS after a clean installation).

2.  Create a new VD under that VD for your custom ASP.NET application.

3.  In VS, you need to go to Website/Start Options and change the “Server“ option to “Use custom server“ and set the BaseURL to the VD you just made (i.e., “http://myservername/MyApplicationName“).

4.  In Sharepoint Central Administration,  upload your XSN then activate it on your root site (ie., “http://myservername“).  I thought you had to create a site collection but you do not.  Once you activate it on your root, the path to that XSN will be http://myservername/FormServerTemplates/MyFile.XSN

Now you've got both your custom ASP.NET application and your XSN in the same domain.   Your XmlFormViewer.XsnLocation can be set to the XSN path above and it should work fine with a few minor problems, most importantly, to me anyway, the text in the “title“ row of my forms is mysteriously gone when the form renders and everytime I try to have it post to an HTTP I get some ambiguous wierd error.

Now to figure out how to actually get the post back data from the form.  Hey, baby steps... baby steps.

Above is the image of the InfoPath form actually displaying in my application. I don't like how it adds that bar above even though I turned off the setting for having the toolbar on, it appears that just removes the buttons from the bar. In addition, I note how the bottom bar is longer than the top and the "powered by" is shorter still. Picky, I know, but will be important to making a clean application. This ASP.NET app uses Master Pages though and I love how the XmlFormViewer ties into that so the InfoPath forms looks like it is part of my application. Of course this form is much bigger when all the checkboxes are expanded with their pertinent options but that wouldn't have looked good on a blog now would it!
Posted: Thursday, April 13, 2006 5:19 PM by jkremer

Comments

Anonymous said:

InfoJet Service is a .NET class library to publish InfoPath Forms to the web for developers. .NET web application with integration of InfoJet Service support the users to edit InfoPath Forms in Internet Explorer or FireFox.

InfoJet Server is an ASP.NET Web Application for general users. General users could use it to edit InfoPath forms in the browser, and they could download InfoPath forms into their local disk or email them in attachment.

InfoJet EditPart is a set of Web Parts that allow SharePoint users editing InfoPath forms via the browser. InfoJet EditPart uses InfoJet Service as the InfoPath forms engine. It is Plug & Play for SharePoint, No need any programming.

http://www.infojetsoft.com
# May 27, 2006 8:03 PM

Infoman said:

Thank you very much for posting the InfoPath xmlformviewr experience. I understand your frustration because recently I went through the same.

Basically, we have existing asp.net application we are trying to use xmlFormviewr to load infopath forms.

Problem is our application is running under iis under default website. For xmlformviewer to work for this application and also from your experience looks like we have create Virutal Directory under sharepoint central admin web site.

It would be nice if we keep the app in current web site and which displays infopath templates residing in sharepoint cetral admin web site.

But because ASP.NET application and your XSN needs to be in the same domain it may not work.

Also, I had to activate site collection setting in sharepoint admin central web site to publish my infopath form as browser (after hours of googling)

Another issue i am facing right now is i have to have infopath installed on the server to code because of the infopath.xml.dll.

Since Office Form Sever cannot be installed on xp pro(my local machine) I have to use window 2003 server environment for the .net code development.

Please let me know your thoughts and keep me updated with the progress.

Your blog provide light at the end of the tunnel for developer like me knowing someone else also is going through the same pain.

# January 29, 2009 8:00 AM
Anonymous comments are disabled