views:

395

answers:

1

I have an ASP.Net MVC Page with a very simple form on it: One Textbox and a submit button. The form uses the standard mvc BeginForm() syntax:

<% using (Html.BeginForm()) { %>

When the page is opened directly, everything works fine.

However, we have another web site (non MVC) that loads this page within an iFrame. Most browsers seem to handle this situation fine, except for IE7 (and IE6). Submitting the form when it is in an iFrame from IE7 causes the form to be posted in a new window.

Is there anything I can do stop the new window from opening, so the form is posted within the iFrame? I would prefer something that is ASP.Net MVC specific, but I understand if it must be a Javascript/JQuery solution.

Edit:

I should note that the parent page with the iFrame is actually using Microsoft CRM 4.0

+4  A: 

Turns out this is a CRM security setting that was enabled.

An IFRAME in CRM has a Security property to "Restrict cross-frame scripting". Seems that by default this is turned ON. When it is on, any links and form posts will always open in a new window, regardless of what html you write.

If this setting is turned OFF, then any links and form posts will reuse the IFRAME.

eyesnz