Just today an old existing SharePoint 2007 environment was re-introduced into the InfoPath development process for my current client and this morning when trying to preview a form either through InfoPath 2007 designer or InfoPath Form Services and using the InfoPath function "UserName()" the below error was given (error when viewing through InfoPath 2007).
The full error message is
InfoPathYour user name cannot be verified because the form's security settings do not permit it.Error occurred during a call to property or method 'get-UserName'.
The problem started to happen when the "Domain" textbox on the "Preview" screen and "Enter the URL of a server that is running InfoPath Forms Services and can be used to verify compatibility" textbox on the "Compatibility" screen from the "Form Options" menu was set to point to the development SharePoint server. Below are visuals of the options that I'm talking about.
The error sort of took me back at first because there weren't any problems with any of the previous forms. Since this was a new form I was thinking that there was a setting that was not correct but that wasn't the case. While troubleshooting the issue I changed the form security to "Full Trust" from "Domain" and everything was working but I knew that wasn't the solution but it got me thinking in a different direction. It got me thinking that it wasn't an InfoPath problem after all. To further that theory I changed "Preview" and "Compatibility" values to point to production and when I previewed the form everything worked with no errors. This confirmed my theory in my mind that it wasn't an InfoPath problem and I started to think what else is tied into InfoPath.
So naturally I thought it could be an IE issue because we all know that IE is an integral part of InfoPath. The first thing that I did was open each SharePoint site that I was using in IE and looked at the security zone for each site. To my surprise there was a difference between them. The production site had "Local Intranet" and the development site had "Internet". You can easily tell this by looking at the bottom right corner of the IE 7 browser. After noticing this I added the development site to the "Local Intranet" zone and then tested my InfoPath form out again and there were no errors this time.
Cheers......!
Source:www.sharepointblogs.com