A couple of week ago a colleague of mine had a strange problem when running an ASP.NET WebForms application containing an UpdatePanel and a Response.Redirect inside a server side button click event handler. The same thing happened on my computer and yesterday I bumped into the same boring thing once more. I felt I had to find a proper solution to this!

Continue reading »

 

The other day I dumped into troubles getting an ASP.NET web application to work after migrating it from .NET 2.0 to .NET 4.0. It turned out that the problem was not bound to the .NET version but instead to the Managed Pipeline Mode settings in IIS7.

Before the migration to .NET 4.0 the application run as a .NET v2.0 Classic application pool and everything was running smoothly. The application uses a custom HttpModule for NHibernate session and transaction management, configured in web.config. All SQL CRUD stuff worked fine but the updates misfired after the upgrade.

Continue reading »

 

Dependency Injection (DI) makes it easy scaling out/up a system, making the code testable and easier to maintain. You don’t have to worry so much about class dependencies and initializing objects, properties in classes and implementing smart and easy to use constructors.

I will state an example below to point out the power of the DI support in Spring.NET.

Continue reading »

 

It was really way too long ago since my last post here, therefore once more I decided to get things going again. My last post was on Dependency Injection using Spring. NET Application Framework (read it here,  Dependency Injection using Spring.NET ), and that made me want to dig deeper into the Spring.NET Application Framework.

So I have decided to write some posts about this particular framework, just to make myself learn it better. So far I have four subjects for upcoming posts in mind:

  • Dependency Injection, IoC (once more, but with a somewhat different approach)
  • WCF and Spring.NET
  • NHibernate and Spring.NET
  • Spring.NET and ASP.NET MVC

If you want to read about the framework do it on http://www.springframework.net and http://www.springsource.org.

So, let’s get things going again!

 

In my previous post I declared I was keen on to learning Dependency Injection, using the frameworks listed. First up is Spring.NET, an open source .NET (C#) implementation of Spring Framework for Java.

I decided to just scratch a little bit on the surface of the framework and therefore went ahead following the first example/tutorial on the Spring.NET site. This covered the basics of Dependency Injection and the framework’s IoC (Inversion of Control) features. I’ll demonstrate it using a similar example below.

Continue reading »

 

A couple of hours ago I decided to learn how to use Dependency Injection. Some googling later and I had found a handful of frameworks for the .NET environment.

I will try a couple of the frameworks and state my personal opinions on them:

More information in upcoming posts.

 

In this article I will present an easy to understand example when to use Data Contract Known Types, e.g. the KnownTypeAttribute class, to make a WCF Service serialize and a service consumer deserialize types when using inheritance. The MSDN has the complete documentation on this, take a look here: KnownTypeAttribute Class.

In this example I will use a hierarchy of different types of vehicles, e.g. a base vehicle type, a car type, a bike type and a kid’s bike type. I will use WCF 4 (.NET 4), Visual Studio 2010 and the WcfTestClient to test the service.
The great thing with KnownTypeAttribute is that WCF can expose one method supporting all types in a class in a hierarchy.

Continue reading »

 

WCF 4 comes with a bunch of new features where I find the service announcement and service discovery really cool. In this article I will implement a couple of services using these new features.

A couple of key words and classes for the scenario are SeviceDiscoveryBehavior, UdpAnnouncemenEndpoint, AnnouncementService. I will describe those classes along the way, but on MSDN you can find more information here: WCF Discovery Overview.

In my previous article I linked to a great article written by Aaron Skonnard, don’t miss it: A Developer’s Introduction to Windows Communication Foundation 4. It covers most of the new features in WCF 4, the simplified configuration, Workflow Services and a bunch of other stuff.

I will describe the scenario below along with a couple of code snippets.

Continue reading »

 

In a previous article, Multiple web service references sharing types, I wrote about sharing types between referenced web services. That article used the old ASP.NET Web Service technique, but nowadays WCF is the technology to use. In this article I will use much the same scenario as in the previous article, Visual Studio 2010 and of course WCF (.NET 4).

I will describe the scenario below, describe what may be an upcoming problem and what can be done to avoid it. Please read the previous article as well, it is much the same solution that is to be presented here.

If you are not familiar with WCF and DataContracts you can read David Chappell’s article here: Introducing Windows Communication Foundation in .NET Framework 4. Aaron Skonnard has written a great article about WCF 4, read it here: A Developer’s Introduction to Windows Communication Foundation 4.

Continue reading »

 

mvc-logo-landing-pageLast week I had the pleasure of listening to a presentation from Scott Guthrie here in Stockholm, http://weblogs.asp.net/scottgu/archive/2009/12/06/my-presentations-in-europe-december-2009.aspx. One of the most interesting parts of the all day event was his talk about ASP.NET MVC 2. Yesterday I had some time off and started to try things out using Visual Studio 2010 Beta 2 and the ASP.NET MVC 2 template. It was running smoothly for a while until I bumped into a problem I recognized from earlier. I didn’t remember the solution right away, but soon I figured it out what was the key point in making the routes, registered in Global.asax, work properly.

The order when adding the routes using the MapRoute method on a RouteCollection object is important to avoid getting a 404 page when browsing to pages that are supposed to work. I will present the problem and the solution for it below.

Continue reading »

© 2011 freddes.se Suffusion theme by Sayontan Sinha