Posts

Showing posts with the label asp.net mvc

Could not load file or assembly msshrtmi or one of its dependencies

So, I recently upgraded my Azure Tools to October 2012, and everything decided to fall apart in my deployment environment . Great. Thanks Microsoft. I installed the latest tools, fixed the code caused by the breaking changes in the Azure Storage Client Library  and then having tested locally - fired off a deployment to Azure. I then got greeted with a YSOD saying: Could not load file or assembly msshrtmi or one of its dependencies Erm, say what now? I don't even have a reference to this anywhere in my project. However, I know that when that is the case, this is normally some low-level GAC'd thing that is causing the problems. A quick Google reveals that I am far from alone on this issue. I ended up trying out the steps outlined Trying out  this stackoverflow answer . I skipped over this code-based solution as frankly, it seemed way too hacky for me. I tried removing all the 'PlatformTarget' references, as mentioned here . All to no avail.. I Found This F...

ASP.NET MVC Filters and Model Binders Intro

I thought the next stop on my MVC tour would be Filters and Model Binders . Since I am still grokking some of these bits – nothing detailed here, but wanted to share what I have found so far. Filters Filters allow us to perform actions against Controller Action methods (i.e. requests from users). Types of Filters There are four “types” of Filters: Authorization – Performed before the action method or any other filters run. Allows you to grant/deny access before any other code is executed. Example: AuthorizeAttribute ). Action – Can be run before and after an action method. Ideal for doing any model data manipulation etc. Couldn’t find examples in the core framework but projects like MvcContrib has them . Result – Runs after the action method has completed, but before the response is returned to the view. Ideal spot for last-minute changes to the response. Example: OutputCache . Exception – Runs after everything else, allowing you to catch any/all exception...

Partials in Spark View Engine

Continuing my journey with Spark , the next natural stop for me after the basics was “partials”. I am a uber-fan of DRY (almost fanatical) so was keen to try and cut down the dupe of HTML etc. I thought I would share the “partials basics” for both you and me :) What Are “Partials”? “Partials” are basically snippets of HTML/”code” markup that can be used throughout your MVC application. This reduces code duplication and helps keep your site maintainable. It can also make your markup easier on the eyes, since you can isolate chunks of markup into “units of functionality” (e.g. a “navigation bar”). What Are Partials NOT? UserControls . People often relate/confuse partials with user controls, and they are NOT. While UserControls can encapsulate HTML, code behind, events and be packaged into assemblies etc. Partials are still (or at least should ) be pretty “dumb” views. Why Use Partials (and MVC) When UserControls Do More? If you are more interested in mashing up code with ma...

RCP: Spark View Engine Bootstrapper

So, tonight I had a RCP session with @JohnnoNolan – we decided that for our topic, we would like to “File > New Project” and see what it is like to replace the default ViewEngine in ASP.NET MVC with the Spark View Engine . Why Spark View Engine? I have heard a lot of buzz about it from the developer community. Also, I heard the podcast on Hanselminutes and the notion of it all just sat right with me - there shouldn’t be such an epic battle between HTML/C# in your views. Our sole purpose in the View is to render HTML based on some model data – make it easy . RCP Session Aims Neither myself or Johnno had any real experience with Spark before the session. As a starting point, I thought it would be good to cover what I would consider to be the “basics” for views: Using variables from ViewData. Using strongly-typed model data. Using master pages. I decided to spend 1 hour before the session having a quick run-through of the install process and the basics in th...

ASP.NET MVC User Controls on Master Pages

Image
NOTE: I was originally going to post the investigation into the User Control/Master Page problem AND the User Controls code in one post. However, I thought it would possibly be a bit confusing so will post separately. This explains why the lab code is called “mvc-versionedfiles”. I am real new to MVC. Up to this point I have found it to be quite pleasurable , I really liked the separation of concerns, the conventions and the testability. Something was bound to cause a bump in the road, and I finally hit it. The Problem I spoke to a couple of guys ( @JeremySkinner and @robinem ) at WebDD09 about this problem. What I was trying to accomplish was appending the file version of my CSS/Javascript files automatically to the LINK/SCRIPT elements in the HTML within the ASP.NET Master Page . For example: 1: < link rel ="Stylesheet" type ="text/css" href ="site.css?1.00" > Why Bother? The reason is this, many browsers are very ...

ASP.NET MVC - First Impressions

Image
Another item on my Tech ToDo is MVC Frameworks. I have been meaning to get in to MVC frameworks for ASP.NET pretty much since I first heard of them so it has been great to finally get a chance to sit down and have a tinker. What is MVC? MVC stands for Model View Controller – it’s a software design pattern that aims to separate the concerns of: The Presentation of the Data (The View) How the data needs to be viewed should not impact any other code. Code should take the data and then build its own representation based purely on that. For example, if we had an awesome Philly steak and cheese sandwich, we could present it in a number of ways - we could have a photo, we could have a video of someone chowing down on it, or we could just put how it makes us feel on plane banner. What changes about the actual sandwich? Nothing. Presentation changes should not require changes in the data. The Data Itself (The Model) The model is basically the heart of the data. This is where we...