X-Frame-Options in ASP.net MVC 5

I had created an application that was meant to be displayed in a frame loaded from another url. There were issues with the frame not loading properly and using developer tools the console displayed the error:

Refused to display '...' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'

The fix to this was to add :

AntiForgeryConfig.SuppressXFrameOptionsHeader = true; 

to the Application_Start function in Global.asax. You must also add:

using System.Web.Helpers;

to get access to that.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s