Today, I got an "401: Unauthorized" exception when calling the WebClient.DownloadFile method to download an Infopath file from SharePoint, even if I provided the correct permissions (setting the WebClient.Credentials property).
This was because of the Infopath Forms Server feature in MOSS 2007 Enterprise edition. This feature redirects to the /_layouts/FormServer.aspx page, apparently this was resulting in an Unauthorized exception.
A workaround is to add "?NoRedirect=true" to the url, like this: http://ServerName/sites/SiteCollection/FormLibrary/Form1.xml?NoRedirect=true.
More information about some Query Parameters you can use on the /_layouts/FormServer.aspx page: http://msdn.microsoft.com/en-us/library/ms772417.aspx
Subscribe to:
Post Comments (Atom)
6 comments:
Thanks so much! I've been struggling with this for a while and this fixed my problem. Also, you're post has a small typo; the query string key should be "NoRedirect" instead of "NonRedirect".
Thx for your feedback Kevin, I fixed the typo...
Really appreciate your post; been struggling with this for a few days.
Thank you very much.
I like your Post very much and It is very interesting. I will use this Info to Develop the SharePoint Applications. Thanks for share this valuable Information.
I really like the blog Post. Keep posting! Also a good referring source for SharePoint related updates and SharePoint migrations
http://www.dshift.com/sponline
A special thanks for this informative post. I definitely learned new stuff here I wasn't aware of !
Post a Comment