Dave Burke : Freelance .NET Web Developer specializing in Online Communities

Got big ASP.NET 1.1 to 2.0 Migration plans? FUHGETABOUTIT!

These are initial rumblings resulting from my ASP.NET 2.0 shellshock in attempting to migrate a reasonably sized ASP.NET 1.1 project to ASP.NET 2.0.  The thesis of my rumblings is that the ASP.NET 2.0 development model is far more different than ASP.NET 1.1 and requiring a much greater investment in migration and adoption than we were led to believe.

...Or maybe I'm just pissed that migrating my 1.1 app to work in VS2005 is a helluva lot harder than I thought it'd be.

Here are just a few of the rumble bits I'm chewing on at the moment.

  1. From a MSDN ASP.NET migration reference.  The code inline model is now the default model for Visual Studio 2005. Code-behind classes become partial classes.  They "expand" the .ASPX page in 2.0.  In 1.1, the ASPX pages inherited from the code-behind classes.   In ASP.NET 2.0, a partial class is particularly useful for code-behind files, as it removes the inheritance relationship that is present with the older code behind model

    That's a rather significant change, seems to me, particularly how it impacts migration.  Think of all of those "The type 'this code-behind class' already contains a definition for txtName" for starters.

  2. From a MSDN conversions issues reference. The new ASP.NET 2.0 compilation model uses multiple assemblies that are normally dynamically compiled on the server. This model improves both Web site performance and updatability.  However, if your ASP.NET 1.x code-behind files reference another code-behind file, then you will have a broken reference because the referenced code-behind file will no longer be in the same assembly.  The solution is to create an abstract base class in the App_Code folder to reference at compile time, which will load the actual class from the page assembly at run time.  As in

    App_Code\Stub_Control1.cs

    abstract class Control1 : System.Web.UI.UserControl {
        public static string myName = "Control1";
        abstract public void foo();
    }



    THAT sucks.

  3. From some other MSDN page.  "Most Web applications require one or more support classes. In ASP.NET, the preferred method was to create a separate project for support classes and then add a reference to the support project within your Web application. Even if you didn't create a separate project, you still had to create a reference to whatever namespace you used within your own application. Although having a separate project made sense for larger and more complicated applications, it was often painful for developers who only needed one or two simple classes.  ASP.NET 2.0 introduces a new way of adding support code, the /code directory..." 

    So I shouldn't be thinking in multiple projects. Namespaces are painful to use?

All I know at the moment is that life was good when I could inherit a webpage from a basepage class and pass both ASP.NET controls and my usercontrols up to the derived pages.  Now I've got some damned abstract Stub_MyPage_aspx_cs.cs in an \app_code directory telling me my basepage class doesn't exist and null reference errors on ASP.NET web control instances thrown from my base class. 

I remain confident that life with ASP.NET will be good again.  Right now I'm just not feeling the joy.

 

Comments (10) | Post RSS RSS comment feed

Posted on 12/1/2005 7:36:00 PM by Dave Burke
Categories: .NET
Tags: No tags for this post

Related posts

Comments

12/1/2005 10:19:43 PM Permalink

Thanks for sharing your pains Dave. I haven't yet started migrating anything large yet, but will be soon. Hopefully I can come up with a better game plan thanks to your comments.

-Ryan

Ryan Farley |

12/2/2005 5:13:39 AM Permalink

Ryan, I'll try to provide more constructive and helpful posts on ASP.NET 2.0 in the future.  I might actually figure some of this new stuff out at some point!  Cheers!

daveburke |

12/2/2005 5:41:00 AM Permalink

Sometimes Dave,   I think you're reading my mind or something.  

This morning I started my 2k5 install with the thoughts of migrating my existing 1.1 sites to 2.0.    Installs chugging along,  I open up my news reader and there you are with conversion issues.

Please post more on your issues and any solutions.  I'm curious as to how hard this will be.   If I find something interesting, I'll let you know.

Dave Kekish |

12/2/2005 5:45:08 AM Permalink

Hey, Dave!  Yeah, there's some Live From Vermont--Meandering Blogger symmetry happening.  I'll post happy ASP.NET 2.0 experiences if you will!

daveburke |

12/2/2005 5:50:02 AM Permalink

LOL.   Thats funny.  Have a good one Dave.

Dave Kekish |

12/2/2005 5:52:34 AM Permalink

Hey, Dave.  Yeah, we have to laugh or cry about it.  I'll be standing by for positive ASP.NET 2.0 experiences coming out of Ohio.

daveburke |

12/2/2005 10:39:41 AM Permalink

Hi Dave,

I'm sorry to hear you are having troubles with your conversion.

Regarding issue 1, we have found partial class problems are fairly easy to fix by re-working your code to not reference private, hidden id variables. If you really need to access them, then you can create a public property to access them. We have not hear much feedback that the change in inheritance has affected most migrations.

Issue 2 is a biggie, but the latest web project conversion wizard in VS05 should detect and create abstract base classes when needed.

I am not sure I understand issue 3. For larger projects, using a separate project and referencing it makes the solution easier to maintain and support. For smaller projects, using the App_Code folder to automatically compile classes for use in your web app is perfectly fine. What exactly is the problem you are finding?

For all those reading this, there are some excellent white papers (if I do say so myself) which will help immensely when converting your 1.x web apps. Check out the "step by step" and "common conversion issues and solutions" white papers at this URL.

msdn.microsoft.com/.../

Finally, for those who have questions on converting, we ask that you to post your question to the "Migrating from VS03 to VS05" forum at http://forums.asp.net since we have team members monitoring these forums.

Many thanks,

-Mike-

Michael Bundschuh |

12/2/2005 10:51:18 AM Permalink

Michael, Thanks much for your help!  I'm sure I'll be spewing out happier blog posts on ASP.NET 2.0 in due time.  At the moment I'm still DOA, but will be investigating on how to get moving.  I've already read several of the docs you referenced.  I didn't know about the migration forum.  Thx!

1) I don't reference private and hidden id variables, but the change in the code behind inheritance model accounts for most of the cuts I'm getting.

2) The conversion wizard DID create an abstract class for me, but it tells me that the base class doesn't exist.  Will investigate further...

3) I'm having trouble getting out of a namespace approach to navigating my code to using the \app_code directory.  T-r-o-u-b-l-e.  The light will shine at some point.

Thanks again for your input and for visiting my blog, Mike.  Have a good day.

daveburke |

12/7/2005 11:29:01 AM Permalink

Regarding 1, could you describe the inheritance structure more. Or send me an email with the base and derived classes. It sounds like what you are doing should work so I'm wondering what I'm not getting.

Regarding 3, you should continue to use separate class projects if you are comfortable with them. Your namespaces should remain the same then.

-Mike-

Michael Bundschuh |

12/7/2005 11:34:45 AM Permalink

Michael,  ScottGu graciously offered to take a look-see and, well, the story is on following posts under "ScottGu Bits."  Thank you very much for your continued support.  It means a lot.  Everything is great in ASP.NET land.

Of course, I'm stuck at the moment on an ASP.NET port error:  "...access a socket in a way forbidden by its access permissions" if you know anything about that. Smile


daveburke |

Comments are closed

This site was built with the Sueetie .NET Online Community Framework. Learn more about Sueetie at Sueetie.com.