By Michael van der Meulen on
2/12/2010 8:16 AM
With the latest MVC2 Release Candidate 2, it was decided to suddenly switch from input validation to full model validation.
In the past, only input data that was submitted to the server was validated when the controller was invoked. Now, all parameters to your controllers are checked, whether they are actually submitted by the client or not. The complete details can be found at http://bradwilson.typepad.com/blog/2010/01/input-validation-vs-model-validation-in-aspnet-mvc.html.
While it seems a worthwhile enhancement, the release notes for MVC2 RC2 simply state “… Applications that depend on the ASP.NET MVC 1.0 behavior may require changes.” This is probably the understatement of the year (at least for the MVC world). Only the most trivial applications will work as-is. Anything more involved, particularly people who understood that MVC performed input validation, not...
Read More »
|
By Michael van der Meulen on
2/3/2010 2:08 PM
Having worked on a fairly large project (for one person anyway) for a few months now, all based on ASP.NET MVC 2, I’m still a fan of MVC. But, I also have found some problems, that tarnished the experience a bit.
First off, DataAnnotations are no doubt very useful. But, it seems impossible to use the same model with more than one set of metadata. For example, an “Edit” form may show other fields and/or error messages than the “Create” form for the same model. As far as I can tell, there can only be one “buddy class” or MetadataType attribute. It’s possible to work around this with models derived from a base class and some code to (shallow) copy properties between the classes. But it’s a shame that it’s limited “by design” at this time.
All right, “separation of concern” seems to be a buzzword that the MVC proponents use a lot (forgive me, I’m still an MVC fan). Practically, this means that your code is...
Read More »
|
By Michael van der Meulen on
12/29/2009 11:22 AM
Update: The solution in this post no longer works as MVC RC 2 has switched to full model validation which is a breaking change. I’m looking into another solution at this time.
I recently tried to resolve a small problem with MVC form validation. In the process I discovered a few tidbits about MVC that I missed in the past.
I was trying to get Ajax forms (Ajax.BeginForm) to work with the client-side validation that is included in MVC 2 RC. Even in this latest release candidate, there are still a few problems, but it looks like it’s getting there. Because the submit handler runs before the jQuery validation plug-in, I abandoned this approach (for the time being) and returned to simple server-side validation, still using Ajax, but without the client-side validation.
I was surprised to struggle with a simple scenario, where a radio button selection disabled some textboxes (using jQuery). Since the textboxes had the Data Annotations “Required” attribute, the server-side validation of course complained...
Read More »
|
By Michael van der Meulen on
11/24/2009 2:34 PM
If you spent any time on a x64-bit version of Windows XP, Windows Vista or Windows 7, you probably encountered the \Windows\SysWOW64 and \Windows\System32 folders. As you know, System32 holds all 64-bit DLLs, Exes, etc. and SysWOW64 has all the good old 32-bit files. Yes, the naming is odd to say the least. There are many posts about this, but this is how it is – we got used to it.
Then, the Windows Registry has similar “enhancements” in 64-bit Windows. There are a fair number of registry entries that are copied (Registry Reflection) or stored in a Wow6432 node for 32-bit applications (Registry Redirection). All the details can be found at http://msdn.microsoft.com/en-us/library/aa384232(VS.85).aspx.
Ah, you’re back. Confused? You’re not alone. Apparently, even Microsoft’s own can’t always get a handle on this. It seems the recent changes to Windows 7 have broken a few things in Visual Studio that have...
Read More »
|
By Michael van der Meulen on
10/6/2009 10:30 AM
Yes, MVC does seem to preoccupy me just a bit lately. It's a "less plumbing - more performance" framework that seems to be really compatible with my way of approaching web applications. MVC is a powerful framework, but you have to add quite a bit of your own to make your applications work. MVC is designed to be extensible and yes, there's the source too.
MVC usually adds just enough features for me to build on. But with the recent introduction of Areas (for multi-project sites), it may just have overshot my comfort zone. Don't get me wrong, it works great, is well documented, but does a bit too much.
The problem I ran into is that during application initialization, all Areas are discovered using reflection by accessing all assemblies in the site's bin directory. Looking at some current (non-MVC based) production sites, that's just a bit too much for me. While this works fine for quick application development, it doesn't do much for major sites. Of course, this discovery process only takes place...
Read More »
|
By Michael van der Meulen on
9/27/2009 6:44 AM
MVC is the answer to all I always hated about WebForms. Well, maybe not, but it's a new take on web applications, making things like Ajax, jQuery, routing, SEO, html soooo much easier.
I started using MVC 2 Preview 1 and found its support for Areas really useful (more info). I also wanted to use the "futures" RenderAction method, so I can easily piece together a page from various independent partial views (think of these just like modules on a DotNetNuke page). No, I don't want to start a discussion on how RenderAction doesn't quite fit within the MVC pattern. Sometimes, it's just about getting things done, rather than being true to some perceived perfection.
It's just all to simple. Except Preview 1's RenderAction didn't work quite right with partial views in Areas. The Controller in an area was invoked, but then its View could not be found because only the main area was searched.
A quick look (actually, not so quick), revealed that RenderRoute (called by RenderAction) doesn't consider areas. Somewhere...
Read More »
|
By Michael van der Meulen on
8/26/2009 7:24 AM
True, there are tons of posts about using .NET classes from unmanaged code. And yes, it is quite simple. With COM Interop, you can expose any .NET class as a COM object. That makes it callable and usable by pretty much any language that supports COM objects. Essentially, you create a .NET class and define attributes to expose it as a COM object. All the gory details can be found in Microsoft's documentation, which describes this quite well (http://msdn.microsoft.com/en-us/library/zsfww439(VS.71).aspx).
As usual, the real problem doesn't show until you try to use your brand-new application in the real world. You have to deploy your application. We all want XCOPY deployment, where you can simply copy your files over to another computer. But, you can't just run your application, because COM objects have to be registered using Regasm.exe. Yes, that means your .NET class (actually, the assembly) must be registered. (No, not if you use the technique shown below, but read on).
Read More »
|
By Michael van der Meulen on
8/18/2009 7:17 AM
How and why I switched from BeyondTV to SageTV and how I can run many TVs on a low cost (digital) cable budget.
Read More »
|
By Michael van der Meulen on
6/29/2009 5:52 PM
I am not going to say how I feel about WebHost4Life.com, but I will document what my experience with them was like. You decide if I'm just being difficult. Actually, I just want what I'm promised and what I paid for. I wanted to set up a backup account for www.softelvdm.com, so when things go really bad, I can switch in a couple of minutes. DNS isn't a problem as I can switch it equally quickly. Disaster recovery on the cheap.
Read More »
|
By Michael van der Meulen on
6/7/2009 12:29 PM
Just installed DotNetNuke 05.01.00 (Beta 501) on Windows 7 with IIS 7.5. In the past, with IIS 7, you had to make sure to set folder permissions properly and allow NETWORK SERVICE access to your folders and also as a database user (assuming you used integrated security).
You could use Application Pool Identities even with older versions of IIS, but now with IIS 7.5 this is the default! So, with IIS 7.5, NETWORK SERVICE is no longer used and you need to define the permissions for IIS AppPool\DefaultAppPool instead.
More info about the changes can be found at http://blogs.iis.net/webtopics/archive/2009/03/13/changes-to-application-pool-identities-in-iis-7-5-beta.aspx
|