I am trying to create a button inside an infopath form that when clicked will redirect to the SiteCollection homepage but it is not working. Here is my code located in the button's OnClick event:
HttpContext.Current.Response.Redirect(SPContext.Current.Site.Url, true);
When I click the button I get the following error:
An error occurred submitting this form to the Web server. The form will now be closed.
Click Start Over to load a new copy of the form. If this error persists, contact the support team for the Web site.
Click Close to exit this message.
The details of the error only say "Unknown". Even if I use a URL such as http://www.google.com it won't work.
My form is web browser enabled, Administrator approved and published with Full Trust.
Does anyone know how to get Response.Redirect to work properly in an InfoPath form?
Sorry about the weird formatting, I can't seem to add line breaks. Mods, if possible can you edit my post and add line breaks?
Thanks