You are currently viewing the BOOK: ASP.NET Website Programming Problem-Design-Solution section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
I converted the core project and accounts modules to asp.net 2. The only problem i encountered was the XslTransform is now obsolete. I can't figure out how to change it to use the new class xslcompiledtransform
When converting the project to asp.net 2 I can't figure out how to fix this casting issue. In the past I just had to ensure that the base.OnInit(e); came first in the OnInit method. However this is the case even with a fresh install of ThePhile being converted with VS2005 I get the following error everywhere this cast occurs.
An unexpected error has occurred on this page. The system administrators have been notified. Please feel free to contact us with the information surrounding this error.
The error occurred in: http://localhost/ThePhile/Modules/Ne...ategories.aspx
Error Message: Unable to cast object of type 'System.Security.Principal.GenericPrincipal' to type 'Wrox.WebModules.Accounts.Business.PhilePrincipal' .
System.InvalidCastException: Unable to cast object of type 'System.Security.Principal.GenericPrincipal' to type 'Wrox.WebModules.Accounts.Business.PhilePrincipal' . at Wrox.WebModules.NewsManager.Web.Categories.Page_Lo ad(Object sender, EventArgs e) in c:\wrox\ThePhile\Modules\NewsManager\Admin\Categor ies.aspx.cs:line 24 at System.Web.Util.CalliHelper.EventArgFunctionCaller (IntPtr fp, Object o, Object t, EventArgs e) at System.Web.Util.CalliEventHandlerDelegateProxy.Cal lback(Object sender, EventArgs e) at System.EventHandler.Invoke(Object sender, EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Has anyone else come across this problem? Thanks in advance for any help.
This has nothing directly to do with 2005, but this is caused by mismatched DLL versions, or else bad references.
To upgrade to a from version 1.0 to 1.1 (this is not directly applicable to 2.0), the basic compilation model is the same, so you could rebuild the projects piecemeal. You could first delete ALL the .dll and .pdb files because they were built on your old version. This has the unfortunate side-effect of breaking all your references! As you know, you can't compile without having all your references in place for the project you are now compiling.
Which leads to the question: which project can be compiled that has no dependencies on any other project in the solution? That's the one you need to compile first. Then you can fix the reference that any other projects have on that .dll, and you can compile them (assuming they don't need others that you haven't compiled yet). If you're careful you can do this process to build upon any .dlls you already built, and soon you'll have a whole working solution.
What about 2005? The problem is that the basic compilation model changed, and the manner in which projects are handled is now different. In fact, there are no projects - at least not in the way that you know them now. Projects are now just folders, and there is no .dll that belongs to one project. Each page compiles to a separate DLL now, and the way references are handled is different because of this.
The new app_code folder is a common folder that holds common code, and this is compiled and referenced automatically.
This makes it hard to port a complex application made in earlier versions of ASP.NET. For this reason, a lot of companies complained to Microsoft, and Microsoft listened! They'll introduce a new (and optional) project model soon that is quite similar to the old model. This will make it easier to port old applications.