Scott's Blog
Sharing tales of [Alt].NET development
-
Simple MSBuild Configuration: Updating Assemblies With A Version Number
When distributing a library you often run up against versioning problems, once facet of which is simply determining which version of that library your client is running. Of course, each project in your solution has an AssemblyInfo.cs file which provides, among other things, the ability to set the Assembly name and version number. Unfortunately, setting the assembly version here would require not only changing the version manually for each build (depending on your schedule), but keeping it in sync across all projects.
-
jQuery Overview Presentation
Last week I gave a presentation to the UC.NET User Group which provided an overview/introduction to jQuery. Instead of using PowerPoint I created an ASP.NET MVC website and used a jQuery presentation plugin (http://www.viget.com/inspire/jquery-presentation-plugin/) to provide slide navigation and animation, which allowed me to make the presentation very interactive.
-
NHibernate Client Validator ASP.NET MVC 2 Model Validation
ASP.NET MVC 2 improves Model Validation in a number of ways, including the addition of client side validation (ala xVal). If you would like more information on Model Validation in ASP.NET MVC 2, see Scott Gu’s detailed post on this subject. Out of the box ASP.NET MVC 2 includes support for DataAnnotations, and there are some extensibility points available for plugging in your own framework.
-
Guarding against CSRF Attacks in ASP.NET MVC2
Alongside XSS (Cross Site Scripting) and SQL Injection, Cross-site Request Forgery (CSRF) attacks represent the three most common and dangerous vulnerabilities to common web applications today. CSRF attacks are probably the least well known but they are relatively easy to exploit and extremely and increasingly dangerous. For more information on CSRF attacks, see these posts by Phil Haack and Steve Sanderson.
-
NHibernate Validator ASP.NET MVC 2 Model Validation
ASP.NET MVC2 will improve the built in Model Validation in a number of ways, including the addition of client side validation (ala xVal). If you would like more information on Model Validation in ASP.NET MVC 2, see Scott Gu’s detailed post on this subject. Out of the box ASP.NET MVC 2 will include support for DataAnnotations, and there are some extensibility points available for plugging in your own framework.
-
Simple SQL Server Script For Generating NHibernate Classes/Mappings
With the growing popularity of Fluent NHibernate, mapping files are being used less and less. However if you are using HBM/XML mapping files I recently dug up an old SQL script (originally written by my colleague Alan Lai, since modified slightly by myself) which might help. The SQL Script basically generates some mapping/public property fields from an existing database that you can manually copy around into you application to save you some keystrokes.
-
Authorizing Access via Attributes in ASP.NET MVC Without Magic Strings
Recently I developed a strategy which I think works well for authorizing access to user groups (Roles) without using the string names of those groups.
-
Making ASP.NET MVC Actions be Transactional By Default
Given any action method (we’ll use Index), if there is no attribute it should execute in a Transaction:
-
Inserting Transactions into Telerik’s ASP.NET MVC Grid
[The List View]
-
An xVal Provider For NHibernate Validator
I wrote a post about a month ago about using xVal with NHibernate Validator 1.2 which solved a problem I was having upgrading the xVal ‘in-the-box’ provider to work with a newer version of NHibernate Validator. There was a caveat that my solution only worked for ValidatorMode.UseAttribute and I wouldn’t catch XML or Loquacious (or other?) validation. This seemed to work OK, but Fabio Maulo wrote a comment to that post saying NHV has metadata which should be the same no matter which validation mode was used.