Migrating an MVC1 app to MVC2

I ran through this process on the Activate Your Glutes website yesterday and thanks to Eilon Lipton’s migration tool its fairly painless.

That said I did come across a couple of gotcha’s that are worth documenting:

1) I’m using jqGrid with an ajax call back to the server to pick up some JSON data. After undertaking the migration my grids were not being populated even though the actions on the controllers were running correctly. Turns out the reason for this is that JsonResult now, by default, denies when responding to a get request.

This is to prevent JSON hijacking as detailed here. There are two ways of fixing this – configure the ajax call to be a post (which if you’re doing a read is not very rest-ful but needs must) or if the data you are returning is not sensitive then set the JsonRequestBehavior property on your JsonResult to JsonRequestBehavior.AllowGet. I’ve used a mixture of approach depending on the sensitivity of the data.

2) The ValueProvider has been changed in an interface breaking manner. It used to be a dictionary and now, well, it isn’t. If you were doing something exotic this might cause you a problem but if, like me, you were simply getting value’s from it then a call to GetValue() on the ValueProvider will sort you out.

And so far thats all the problems I’ve hit.

Explore posts in the same categories: MVC

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 )


Connecting to %s

%d bloggers like this: