Can anyone recommend an IoC container for ASP.NET 2.0 Webforms? - asp.net

As the title says, I'm looking for recommendations for an IoC container to use with an ASP.NET 2.0 Webforms app. I believe that some containers are .NET3.5 or newer only.

I would recommend Ninject - using the web extensions.
Although it uses 3.5 I think it will work in your 2.0 website.
You'll need 3.5 on the actual machine, but there is just one runtime version executing the app. - .NET Framework v2.0.
This blog, again using 3.5 forms, takes you through steps that should still work for you.

I've used Spring Framework.NET a lot and been very happy with it, but I haven't used it with ASP.NET. It has a release for .NET 2.0, and even has one for .NET 1.1!

I used StructureMap with 2.0.
I'm not sure if the latest version is still compatible, but the version I used back was just great.

Related

Does Unity / Ninject support the latest versions of MVC/WEB API 5.1 and 2.1?

My application is ASP.NET MVC5.1 and ASP.NET WEB API 2.1. The application
is small and currently using Microsoft Unity for IOC.
Can someone advise me if they know of any changes needed to make Unity
work with these very new releases of MVC and Web API?
I am also considering changing to Ninject depending on features.
If I made this move then what features does it offer that the latest version of Unity lacks? My big concern is that Ninject appears to be well supported whereas Unity seems to be a product that's updated every couple of years when the Microsoft guys have the time to look at it.
Finally how much of a change is needed if I change from Unity to Ninject?
I don't know much about Ninject, but we upgraded our MVC4 to MVC5 application here earlier this week, following the instructions for How to Upgrade an ASP.NET MVC 4 and Web API Project to ASP.NET MVC 5 and Web API 2.
The application is already in production, so I can confirm that Unity supports these new releases! Then you can continue to use it without any damage.
Hope it helps to make your decision.
See ya!
Yes, you can use Unity 3.0.1304.1 in ASP.NET MVC/WEB API 5.1 and 2.1 project.
I use it, because i can't configure ninject without any bugs for latest mvc core libraries.

Web Site Upgrade from ASP .NET 2.0 to 3.5

We have a web application that runs on IIS using .NET 2.0 developed and built with Visual Studio 2005.
We're going to upgrade to .NET 3.5 and begin using Visual Studio 2008. Here are my questions:
I note the runtime is still 2.0-based.
When I loaded the solution in Visual Studio 2008, I was asked to convert, and I did. I then checked the target framework for the default project, and it was set to 3.5. However, all of the other target frameworks for the other projects are set to 2.0.
Do I need to manually set the target frameworks from 2.0 to 3.5 for each of the projects in the solution?
Are there any "gotcha's" anyone can think of to be concerned with a web-application conversion?
As I understand it, the 1.1 to 2.0 migration was a much more difficult issue due to the massive runtime and web-page design changes. However, 2.0 to 3.5 isn't such a big change.
I was not at my current job for that upgrade, but I understand there was a problem with some textarea tags using a deprecated attribute that failed to function correctly after the upgrade.
Can anyone think of any similar issues I might encounter?
Any other issues or thoughts anyone has after having done such a conversion themselves?
Thanks, I appreciate the input.
---Dan---
Do I need to manually set the target
frameworks from 2.0 to 3.5 for each of
the projects in the solution?
Not necessary, but I would recommend you to do so. Visual Studio actually filters the assemblies you can reference based on the target framework version.
Are there any "gotcha's" anyone can
think of to be concerned with a
web-application conversion?
Not any that I am aware of when migrating from 2.0 to 3.5. You don't even need to modify the CLR version of the host application pool. When you need to migrate to 4.0 there might be more issues.
If you're also upgrading your own target server, from my own experiences, be patient with the installer.
It does quite a lot including uninstalling the existing .NET 2.0 and 3.0 frameworks and replacing it pretty much wholesale.
It can look as if the installer is stuck. On one of our production servers it ran for nearly 20 minutes. I was almost ready to pull the plug then it magically jumped into life.

Running an ASP.NET 1.1 application under 2.0

I have an application written in ASP.NET 1.1. If I switch IIS to use 2.0 what issues am I likely to see? Initial tests have thrown no problems, but I was wondering if anyone had experience of running ASP.NET 1.1 applications under 2.0 and could maybe point out some areas to watch out for?
Thanks for any advice.
Just make sure that you are not running different web applications in the same application pool if they require different versions of the .NET framework.
Create separate app pools (at least one for each version of the framework).
Maybe also have a look at this blog post by Brad Abrams about breaking changes between .NET framework 1.1 and 2.0. Here's a short quote :
...we work very hard to ensure that
your V1.1 apps will this just work on
2.0, but none-the-less, this doc is likely worth a quick scan as you
migrate to 2.0
When we migrated our 1.1 applications to 2.0, I don't think we had any problems. There were a handful of cases where the compiler warned us that we should use a different (updated) assembly, but other than that everything was fine.
Most ASP.NET 1.1 applications will run just fine under ASP.NET 2.0. One thing to watch though is that you don't run an ASP.NET 1.1 and an ASP.NET 2.0 application in the same application pool.
The biggest problem we had was connected with the insertion of the xhtmlConformance element in the web.config file connected with javascript libraries, removing it worked fine for us
check this post from Scott Gu.
Usually asp.net 1.1 application migration to 2.0 does not raise any issues. You might need to change the location where you put the class files.
You will see some warnings, some deprecated method call etc.

Upgrading ASP.NET from version 1.1 to 2.0 - Any Gotchas?

I know we are really behind the times here, but we are just about to upgrade from .NET 1.1 to .NET 2.0.
Thank you for your sympathy.
Anyhow, are there any gotchas we should look out for?
Do you have any general advice before we jump in?
Please do not post telling me to go straight to 3.5: 2.0 is all we're allowed!
We're using mostly C#.
Yes. The most important thing for you to know is to use a Web Application Project, not a Web Site. Web Sites use a totally different compilation model and migration is pretty much a disaster. Web Application Projects are much more similar to how things worked in 1.1.
We also had an intermittent problem with redirecting from the login screen, but according to Google, we were basically the only ones who had that problem - we've since resolved it.
Most of the other problems we ran into were small and easy to navigate, and the overall experience was a net improvement.
Here is my recommendation before upgrading:
If you are used to use Visual Studio 2003, you will need to go for VS2005. You will have to convert the old solutions and projects so that it will be compatible with VS2005. Make sure to have a backup of the project you're going to convert so that you can roll back or even use it as source for any modification you may need to the converted projects.
If you're developing web applications using .NET 1.1, make sure that all the virtual directories and applications in the IIS is configured to work with ASP.NET 2.0. You may need also to configure a new Application Pool for your .NET 2.0 applications.
If you're using any third party libraries in your .NET 1.1 projects, you may need to confirm its compatibility with .NET 2.0 projects. Some old libraries used in .NET 1.1 are not compatible with 2.0.
One gotcha is home-grown 1.1 implementations of .NET 2.0 stuff (that was missing in 1.1) like RegistryHandler and so forth. Sometimes your newly-ported 2.0 code will look like it's properly using a 2.0 class when it's really using the home-grown version.
Deployment is another gotcha, if you're upgrading an already-deployed app. You have to switch the .NET version in IIS from 1.1 to 2.0.
I remember we had to change some client scripts, because the way ClientIDs are generated for server controls changed from ASP.NET 1.1 to 2.0.
I don't remember the exact circumstances, but some IDs which previously wer prefixed ctl0_ became ctl00_...

Should I support ASP.NET 1.1?

I've just started working on an ASP.NET project which I hope to open source once it gets to a suitable stage. It's basically going to be a library that can be used by existing websites. My preference is to support ASP.NET 2.0 through 3.5, but I wondered how many people I would be leaving out by not supporting ASP.NET 1.1? More specifically, how many people are there still using ASP.NET 1.1 for whom ASP.NET 2.0/3.5 is not an option? If upgrading your server is not an option for you, why not?
Increasingly I think not.
The kind of large rigid organisation currently still clinging to 1.1 (probably because they're only just upgraded to it) is also the kind that's highly unlikely to look at open source solutions.
If I were starting a new ASP.Net project right now I'd stick with .Net 3.5 and probably the new MVC previews.
Remember that .NET 1.1 is going out of general support in October of this year (and that includes ASP.NET 1.1).
I think you would be perfectly fine with targeting just 2.0 and above, someone who would use your library would most likely be doing new development and using at least ASP.NET 2.0. I think it would be a very small group of people doing new development in 1.1.

Resources