Wednesday, February 4, 2015

PrismJS - Code Formatter for blogs

Note to self: Use this when you eventually get around to styling this blog!

http://prismjs.com/

Tuesday, February 3, 2015

MVC Routing and Areas - Can't find your view?

MVC Routing is weird...

We're refactoring an app to use Areas to break up our app into more manageable pieces. I moved some controllers to the new "Internal" area and tried to access it. It couldn't find the controller by accessing ~/Internal/Controller, but my code would be hit if I did ~/Controller, even though the controller had been moved to the new Area.

Even when hit, it couldn't find the view by calling return View(model);

I added a new controller to the area controller's folder and used that namespace for my existing controller.

Now it works! However, my controller will still be hit if I call ~/Controller or ~/Internal/Controller.

MVC must look at the namespace to determine routing, which I think is unfortunate.

So, if you're having an issue with a controller you moved to an area, make sure you have the correct namespace!