Strong Naming: One Year Later

It is almost 1 year to the date of when I first posted JSON.NET Strong Naming And NuGet Woes and the NuGet compatibility issues have stabilized This stabilization hasn’t happened through a change from Microsoft, but a change in how publishers of NuGet packages version their libraries. I am writing this post, because even after one year I am getting very passionate comments on one side of the issue or not, people don’t seem to take a middle road on the strong naming issue. If you don’t believe me take a look at the comments. ...

April 2, 2013 · 3 min · 624 words · Nick Berardi

JSON.NET Strong Naming And NuGet Woes

This post requires a little understanding about how strong naming works. It’s complicated, but basically here is the jist: When you compile a library against a strong named assembly, only that specific version of the assembly can be used with the assembly that you are compiling with out resorting to heroics. You may say what is the big deal that is how all libraries are compiled and linked. But that isn’t true in .NET, if you don’t have a strongly named assembly, you have for better terms a weakly named assembly. And with weakly named assemblies there is no enforcement of the version, just the library name. So this makes it possible for developers to update a referenced library without actually recompiling the original library that referenced it. This is very powerful in the right hands, and pretty much what makes services like NuGet function with so many intermingling of references between projects. ...

April 3, 2012 · 4 min · 720 words · Nick Berardi

Timing The Execution Time Of Your MVC Actions

I recently had the need to find out how much time elapsed during the execution of just my action, so I created a handy little action filter based on System.Diagnostics.Stopwatch. This action filter adds the elapsed time to an HTTP header, appropriately named, X-Stopwatch. I choose to use a header instead of a response in the content body, so that it could be used both with non-HTML responses (binary, JSON, XML, etc) and HTML response. I was amazed at the usefulness of this simple piece of code, because it instantly gave me insight in to the actual execution time of my action to see if my optimizations were having any effect. It allowed me to monitor the execution time of code that I can specifically and easily control the performance of. ...

October 26, 2010 · 1 min · 211 words · Nick Berardi

ASP.NET MVC 3 Preview 1 Released

The title says it all, so go get your copy today and check out all the new features. You can download it here. New features include: Razor View Engine Dynamic View and ViewModel Properties “Add View” Dialog Box Supports Multiple View Engines Service Location and Dependency Injection Support Global Filters New JsonValueProviderFactory Class Support for .NET Framework 4 Validation Attributes and IValidatableObject New IClientValidatable Interface Support for >NET Framework 4 Metadata Attributes New IMetadataAware Interface New Action Result Types (HttpNotFoundResultAction and HttpStatusCodeResultAction) Permanent Redirect Support in the controller (RedirectPermanent, RedirectToRoutePermanent, and RedirectToActionPermanent) Looks like this is going to be a very worth while upgrade, and a special thanks should be given to Phil and team for making ASP.NET MVC everything that ASP.NET WebForms isn’t.

July 27, 2010 · 1 min · 124 words · Nick Berardi

Creating Your First MVC ViewEngine

A question that I have been hearing a lot lately is: How do I change the view location in MVC? But what they really mean to say is: How do I create a new ViewEngine that uses the view locations of my choosing? It is actually very simple to do, and once you see it, I think you will agree with my assessment. The first thing we are going to do to create our custom ViewEngine, is define the paths that we want to use for our master pages, view pages, and shared pages. I have taken the liberty to define the following paths, you can customize them however you wish: ...

May 11, 2009 · 4 min · 773 words · Nick Berardi

ASP.NET MVC 1.0 Released

It was just announced at MIX09 that ASP.NET MVC 1.0 has been released for general use and is out of the Release Candidate phase. There has been no word on the changes form RC 2 to this release version. But I will keep this post updated as I learn more. Also as of writing this the download hasn’t been posted to CodePlex either, but I am sure that it will be posted pretty soon. ...

March 18, 2009 · 2 min · 382 words · Nick Berardi

ASP.NET MVC 1.0 Release Candidate 2

Phil Haack has announced the availability of ASP.NET MVC 1.0 Release Candidate 2. You can download the new version from Microsoft. Source code and samples are also available on the ASP.NET CodePlex workspace. Overall, this new version doesn’t have many changes in the area of development and tooling, but there has been improvement for deploying ASP.NET MVC applications. The setup process now requires .NET 3.5 SP1 to be installed, where in the past it was optional because the additional assemblies where included with the install. ...

March 3, 2009 · 2 min · 302 words · Nick Berardi

A potentially dangerous Request.Form value was detected in ASP.NET MVC

If you are getting something like the following error message in ASP.NET MVC: A potentially dangerous Request.Form value was detected from the client (Description="some HTML text") This is because of something called Request Validation, that is a feature put in place to protect your application cross site scripting attacks, as described in a White Paper on ASP.NET: Many sites are not aware that they are open to simple script injection attacks. Whether the purpose of these attacks is to deface the site by displaying HTML, or to potentially execute client script to redirect the user to a hacker’s site, script injection attacks are a problem that Web developers must contend with. Script injection attacks are a concern of all web developers, whether they are using ASP.NET, ASP, or other web development technologies. The ASP.NET request validation feature proactively prevents these attacks by not allowing unencoded HTML content to be processed by the server unless the developer decides to allow that content. ...

February 3, 2009 · 2 min · 298 words · Nick Berardi

Introducing the ASP.NET MVC (Part 7) - The Controller

This is a continuation of my Introduction to ASP.NET MVC series. As I outlined before this is in an effort to write the book and keep blogging, I decided to write/blog the last chapter, Chapter 2. I am doing this so I can receive feedback on this chapter as early as possible. Because this chapter, in my opinion, is probably the most critical of the book, it defines the context around ASP.NET MVC and how it differs from ASP.NET Web Forms, as well as giving a historical perspective of the MVC pattern. ...

February 1, 2009 · 7 min · 1294 words · Nick Berardi

Introducing the ASP.NET MVC (Part 6) - The View

This is a continuation of my Introduction to ASP.NET MVC series. As I outlined before this is in an effort to write the book and keep blogging, I decided to write/blog the last chapter, Chapter 2. I am doing this so I can receive feedback on this chapter as early as possible. Because this chapter, in my opinion, is probably the most critical of the book, it defines the context around ASP.NET MVC and how it differs from ASP.NET Web Forms, as well as giving a historical perspective of the MVC pattern. ...

January 12, 2009 · 9 min · 1720 words · Nick Berardi