JSON Issue: This request has been blocked because sensitive information – MVC

Hey everyone,

Started redoing Learner Lessons in MVC4 and AngularJS today. I ran into this little issue while trying to retrieve JSON:

This request has been blocked because sensitive information could be disclosed to third party web sites when this is used in a GET request. To allow GET requests, set JsonRequestBehavior to AllowGet

It turns out that this behavious is intentionally prevented in order to avoid JSON hijacking. Thankfully the data I’m working with is not at all sensitive so the workaround is pretty straight forward:

public ActionResult Index()
{
     return Json(db.Regions.ToList(), JsonRequestBehavior.AllowGet);
}

Source: http://stackoverflow.com/a/4616442/522859

For those of you working with sensitive data that don’t want to risk exposing it, posting is suggested as an alternative on StackOverflow: http://stackoverflow.com/a/6440163/522859

Movies.mdf not in App_data Folder – MVC4 Tutorial

Hey everyone,

I’ve decided to take a look MVC4 (C#) and have just started the Movies tutorial. Unfortunately I ran into a bit of trouble with the database setup, for some reason mine wasn’t appearing in the app_data folder.

Apparently there are a few things you can try here:

Click Show All Files
This one is pretty simple, just click Show All Files
– Project > Show All Files

Refresh
Hit the refresh button
– Project > Refresh

Ensure that you’ve created a movie
You’ll need to make sure you’ve created a movie first. Apparently the database is not created until after a new row is inserted.

Final Solution, also the one that worked for me
The database wasn’t actually created under app_data, instead it was placed under: C:Program FilesMicrosoft SQL ServerMSSQL10_50.SQLEXPRESSMSSQLDATA

This StackOverflow post explains why: asp-net-retrieving-data-from-nowhere