CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums




Can Reply:  No Members Can Edit: No Online: Yes
Zone: > NEWSGROUP > Asp.Net Forum > migration_to_asp.net.migrating_from_asp.net_1.x_to_asp.net_2.0 Tags:
Item Type: NewsGroup Date Entered: 12/30/2004 12:42:00 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
NR
XPoints: N/A Replies: 21 Views: 75 Favorited: 0 Favorite
22 Items, 2 Pages 1 2 |< << Go >> >|
bobwiller
Asp.Net User
Problems with Application Code and Controls12/30/2004 12:42:00 PM

0

We just ran the upgrade wizard on our large 1.1 project using the December CTP, and overall the experience was much better than in previous builds we have used. We now have one problem that probably isn't related to the upgrade wizard, but with the new code seperation and compilation:

Our ASP.NET Web has alot of controls (.ascx files). In 1.1, an example folder structure looks something like this:

wwwroot\controls\dialogs\wizards

Within the wizards directory, there are a series of controls, and one or more .cs class files to support the controls. (Our namespaces also tend to match the folder structure)

After the upgrade to 2.0, we now have a mirrored set of directories under the Application_Code folder. All the .ascx files are in their original directories, and the .cs files have been moved to a matching set of folders in the application_code directory.

What I have found is that the pages and controls can reference the classes in the application_code folders, but the classes can't reference the controls and pages back in the Web site...which is a big problem for us at the moment because we obviously have lots of missing references. (In fact some of those .cs files inherit from the controls back in the Web)

Is this by design? Behavior that will change? Anybody have any suggestions?!
Thanks
Bob Willer
BetaID 267513
cjwilliams
Asp.Net User
Re: Problems with Application Code and Controls4/15/2005 4:12:49 PM

0

Does anyone have an answer to the above question? I am running into the same thing, using Beta 2 and its a major roadblock for us.

Thanks in advance.

 

 

Fredrik N
Asp.Net User
Re: Problems with Application Code and Controls4/15/2005 5:25:38 PM

0

Non-page related files will be moved to the App_Code dir, which includes the .cs or .vb files. The new dynamically compilation model will compile code into different assemblies, so because of this you need to add the Reference directive to the page that will point to the virtual path where the User control is located before you can for example cast your user control to its right type.


/Fredrik Norm?n NSQUARED2
Microsoft MVP, MCSD, MCAD, MCT

Cornerstone

My Blog, ASP.Net 2.0 etc
cjwilliams
Asp.Net User
Re: Problems with Application Code and Controls4/15/2005 7:56:07 PM

0

Thanks Fredrik,

Sorry about the clarity of my post, the problem I am having is that the classes in the App_Code folder cannot find a reference to classes used for Pages and UserControls.

So class "A" is in the App_Code folder and is trying to instantiate a WebUserControl "AControl"

AControl a = new AControl();

The compiler returns The type or namespace name 'AControl' cannot be found .....etc

Is there someway this class can reference Page and UserControls?

Thanks for you help.

kashif
Asp.Net User
Re: Problems with Application Code and Controls4/17/2005 9:04:25 AM

0

Williams,

The issue you are seeing is due to the fact that app_code is compiled separately [and before pages/uc are compiled in the app] and has no references to pages/controls existing outside this directory. One possible workaround can be that you declare a base UserControl class in app_code - use this to do the instantiation and make your usercontrols derive from this UC class.

Thanks, Kashif

chrisfewtrell
Asp.Net User
Re: Problems with Application Code and Controls4/28/2005 10:48:53 AM

0

I have recently installed Vis Studio 2005 Beta 2 and have come across exactly the same problem as bobwiller and cjwilliams when trying to compile our ASP.Net 1.1 code.

To re-iterate what the problem is: -
Our code used severel classes which manipulate user controls, because these classes are compiled prior to the user controls and in isolation to the user controls, the compiler rightly complains that it cannot find the user control classes.

Eg.
MyWebApp
    App_Code
        HelperClass.cs
    MyUserControl.ascx
 
<inherits from System.Web.UI.UserControl>
In helper class I have some code that does something with a MyUserControl object. 

I don't think I understand your work around Kashif - how would creating a base class for our user controls help? 
Are you suggesting I do the following?

MyWebApp
    App_Code
       HelperClass.cs
       MyUserControlBaseClass.cs
<inherits from System.Web.UI.UserControl>
    MyUserControl.ascx <inherits from MyUserControlBaseClass>

Sure I might be able to  instantiate new MyUserControl objects using something like LoadControl("~\\MyUserControl .ascx") but I still would not be able to cast them in code to MyUserControl (i.e. (MyUserControl)LoadControl("~\\MyUserControl .ascx") would still produce a similar compiler error as before.)   Have I misunderstood?  Could you please give more detail about your work around because at present I currently stuck and cannot make any progress.

Has the ability to completely compile ALL the code (code behind as well as separate classes) into a single dll (i.e. the 1.1 way of doing things) been removed from Visual Studio 2005?  I have tried publishing the our web app (reading the docs it sounds like publishing should do a precompile of all our code) but this fails with the same compilation errors.

I get the feeling that I must be missing something very simple/obvious (or at least I hope I am - otherwise it means we will have to do some very major remodelling / re-writing of our current ASP.Net codebase to get it to compile under Vis Studio 2005.  I can't believe that it is only bob, CJ and I that are finding this problem).

TIA

Chris
asaxton
Asp.Net User
Re: Problems with Application Code and Controls4/29/2005 4:55:09 PM

0

I just hit the same issue.  Tongue Tied [:S]  I understand the suggestion of making a base control, the problem is that i want to access a property of the real control and don't have a way to do that because i can't cast it to it's true type.
chrisfewtrell
Asp.Net User
Re: Problems with Application Code and Controls4/29/2005 6:10:24 PM

0

I *think* I understand Kashif's suggestion.  Make an interface (or base class with virtual methods) in the App_Code folder with the  methods or properties that you want to access from your other code in App_Code

For example (using my classes above) if I know that I want to access the property Donkey on MyUserControl from HelperClass I could define an interface

public interface IMyUserControl
{
    string Donkey {get;set;}
}


put this in a file in App_Code and have MyUserControl implement this interface.

Then in HelperClass I would cast the MyUserControl to IMyUserControl

eg.
IMyUserControl myUsrCtrl = (IMyUserControl)LoadControl("~\\MyUserControl.ascx");
myUsrCtrl.Donkey = "Mule";


This compiles and runs fine but I don't like it - it means having to create a lot of (IMO) superfluous base classes or interfaces in App_Code and feels wrong.  Have I understood you correctly Kashif?
asaxton
Asp.Net User
Re: Problems with Application Code and Controls4/29/2005 8:10:57 PM

0

Yeah that makes sense...  but i agree i don't like it...  Doesn't seem as natural as it did before.
Baiju
Asp.Net User
Re: Problems with Application Code and Controls4/29/2005 8:14:44 PM

0

Yes. this is a work around.

Additionally, if you keep same name for new class in App_Code, and give a new name to Code behind class say, class MyUserControl_Imp : MyUserControl you just need to change the name only at the current page (change Inherits="MyUserControl_Imp") and the code behind file. You donot have to change other places where it is referenced.

You donot take this approach for all CB classes, only the classes referred from App_Code or any other Code Beside  file. How about getting it done automatically?

 

Baiju

 


"This posting is provided "AS IS" with no warranties, and confers no rights"
chrisfewtrell
Asp.Net User
Re: Problems with Application Code and Controls4/29/2005 8:57:05 PM

0

Some automated way of doing this may be a benefit - although I think the ideal (i.e. zero work for me Big Smile [:D] and zero code changes) solution would be if Whidbey had a "compile everything into one dll like Visual Studio 2003" option.   I do however appreciate that this option may not be favourable (or indeed possible) considering the new aspx/ascx inheritance & compilation models.

Are you the same Baiju who wrote the blog (http://blogs.msdn.com/baiju/archive/2004/11/15/257866.aspx)?  If so I guess you are pretty familiar with the conversion tool and Whidbey.  In your opinion (and I am not going to hold you to this Smile [:)]) is this "1.1 compilation" option feasible and is there a realistic chance such a feature may be included in the final release of Whidbey?  How many developers would have to whinge (and how loudly) to get  this feature in?
 
If this feature is not possible then obviously some automated way of doing would help.  Is it feasible that the conversion tool could be modified to deal with this problem?  I don't particularly like Kashif's suggested work around (because of the need to create otherwise redundant base classes) but in lieu of a more elegant solution, could the conversion tool do this for us?

Obviously there are many, many businesses that have (like my company) developed large and fairly complex web apps under 1.1 which will suffer from this problem- and I think none of us relish the idea of having to chop and change our code around just to get them to compile with Whidbey.  On the other hand, we would like to start developing with .Net 2.0 because we can see the tangible benefits the language & framework improvements, VS2005 (& Team studio) will bring.  We really (really) want a nice and easy (i.e. low developer effort) upgrade path.

On a brighter note let me add that all our windows code (C# and VB.Net) went through the conversion tool and compiled and run with no extra modifications Party!!! [<:o)]Party!!! [<:o)]

mbund
Asp.Net User
Re: Problems with Application Code and Controls5/1/2005 11:02:53 PM

0

Chris,

Let me answer for Baiju. When we designed VSO5, we made a decision not to support the ASP.NET 1.1 model in the IDE. You can run your 1.1 web app in the ASP.NET 2.0 compatibility mode during runtime, but it would have added unreasonable complexity to VS05 to have it support both the 1.1 and 2.0 compilation features.

So we provided a migration feature to convert web apps from 1.1 to 2.0. Our goal is minimize the amount of manual work needed to migrate your web app. But given the extensive 2.0 changes for web projects, it is expected some manual migration work will be needed. We will do everything reasonable to minimize this work.

We are even looking to automate the solution suggested in this forum thread. In addition, we are creating a white paper which will document this and other migration issues and their solutions. We will be sure to post a link to this on these forums when it is finished.

Thanks,


-Mike-

myoungblut
Asp.Net User
Re: Problems with Application Code and Controls5/19/2005 5:15:09 PM

0

So what is the solution?  Create extraneous classes?  Hack together something else??  Is there a temporary solution (i.e. non-white paper) until the white paper is published?
mbund
Asp.Net User
Re: Problems with Application Code and Controls5/20/2005 12:00:22 AM

0

Check out my posting here -- it gives the general idea.

http://forums.asp.net/927765/ShowPost.aspx


-Mike-

bstineman
Asp.Net User
Re: Problems with Application Code and Controls6/3/2005 7:08:39 PM

0

Ok, I understand the problem, and I understand the intent of the hack/workaround.

Please understand when i tell you that this had just made using web user controls significantly more difficult. The first application I attempted to migrate from VS2003 to VS2005 has no less then 6 different user controls that need to be instantiated and accessed programmatically for various reasons.

This is not an insignificant issue for some of us and I do not find the provided workaround to be satisfactory by any stretch of the imagination.
Web User controls and more specifically server controls were a difficult enough topic in VS2003. This latest change has only made them even more unfriendly to work with. This particular change has only made their potential usage even more limited and complex then it previously was. In essence its added more code to an upgrade that we're being told was intended to help reduce the amount of code needed by 60%.

Please look careful at other options for resolving this conflict. I would expect things to remain the same with the upgrade, not get more difficult.
bstineman
Asp.Net User
Re: Problems with Application Code and Controls6/6/2005 6:57:17 PM

0

Pondered and played with this a bit more over and weekend and I've come to decide that I really don't care for this new build model (all the seperate DLL's). What it seems like to me is that its introduced a new namespace style heirarchy to the build process that isn't openly intuitive and sets up roadblocks to assembly cross referrences that isn't readily apparent to the basic developer.

I would really prefer to see a fix for this rather then hack-job style workarounds. Yes the new model helps force people into thinking a bit more carefully about how applications are designed/built, but it also throws some significant roadblocks into the development process and increases the learning curve for the product.

At a minimum, it would be nice to have an option for the old style assembly creation (one dll for the website). Thus allowing older applications to be more easily migrated forward while helping encourage the new build methodology for newer applications. At the very least, make sure this new build order is clearly details and readily accessible for all developers moving to VS 2005.

AJO
Asp.Net User
Re: Problems with Application Code and Controls9/8/2005 1:44:35 PM

0

We have also suffered this problem with the new complitation model -- our application consists of two aspx pages (one for content, one for administration) and hundreds of user-controls to generate the page contents.

We have worked around the problems of referencing objects in other namespaces, but we are struggling with intermittent compile errors. Probably 1 in 3 compiles (maybe more) results in an error "The type or namespace 'Gui_WhicheverClass' could not be found" followed by other related errors (failed casts to Control and the such like). The proposed solution of creating a base class in the code directory is not acceptable, and plus this error is intermittent -- if we keep on Rebuilding the solution it eventually goes away. This is an error with the compiler working on the new project model which, imho, is not a good model -- it does not promote a tidy compartmentalised project structure for large solutions like the DLL did.

I would really like to see a VS2003 style single dll option in VS2005.

mbund
Asp.Net User
Re: Problems with Application Code and Controls9/8/2005 8:31:52 PM

0

Have you gentlemen had the chance to read Scott Guthrie's blog posts on the new ASP.NET 2.0 model? He does a much better job than I could explaining the benefits of the new model.

<p>
http://weblogs.asp.net/scottgu/archive/2005/08/21/423201.aspx

<p>
Also, you should review the "Common Migration Issues and Solutions" white paper.

<p>
http://msdn.microsoft.com/asp.net/migration/upgrade/default.aspx

<p>
Hopefully this will explain the why and the how of getting your application working in ASP.NET 2.0.

<p>
Thanks,
-Mike-

AJO
Asp.Net User
Re: Problems with Application Code and Controls9/12/2005 12:27:53 PM

0

I have read both of those pages. I understand the goals of the 'project-less' webs, but I also think MS have clumsily shot themself in the foot by removing the option all together. Most complaints seem to be coming from people who (like us) have highly modular websites with large collections of server controls and lots of custom classes for the various types of controls to inherit.

I think the best solution would be some sort of hybrid project -- .cs files should have the option of being pre-compiled in to a dll, exactly as with VS2003, and maybe this could be controlled using a page directive. App_Code isn't the answer because CodeFile="/App_Code/.." causes a compile time error. App_Code is nothing more than a cheap subsitute for a seperate business layer DLL which can incremental build without any user input.

We can emulate the project based pre-compiled library, of course, but then we lose the file associations between the ascx/aspx and the .cs files and we get a rather large and unwelcome layer of file administration to add to our procedures. Despite this, and despite the annoyance it will certainly cause, it is more than likely the option we will have to choose.

Currently, the VS2005 web projects are sub-standard and no where near production ready. We are continuously getting random compile errors that some class or other could not be found. A rebuild sometimes fixes it, sometimes regenerates the same error, sometimes leads to another class being unreachable. It is all down to way that these classes are being compiled in to their 'temporary' libraries, and something somewhere going wrong.

Quite simply, the code does not work. It is not a matter of misunderstanding.


Baiju
Asp.Net User
Re: Problems with Application Code and Controls9/12/2005 10:48:24 PM

0

Yes, it is making things more complicated.

Please remeber that a code-behind accessing user control can be solved by <@Reference > Tag in the page.
This abstarct base class is needed only when some stand alone code (in App_Code folder)  accessing code-behind classes (outside App_Code).


"This posting is provided "AS IS" with no warranties, and confers no rights"
22 Items, 2 Pages 1 2 |< << Go >> >|


Free Download:

Books:
Information Security Management Handbook Authors: Harold F. Tipton, Micki Krause, Pages: 0, Published: 2007
Grid-based Problem Solving Environments: IFIP TC2/WG 2.5 Working Conference on Grid-based Problem Solving Environments : Implications for Development and Deployment of Numerical Software, July 17-21, 2006, Prescott, Arizona, USA Authors: Patrick W. Gaffney, James C. T. Pool, IFIP Working Group 2.5--Mathematical Software, Pages: 460, Published: 2007
On the move to meaningful Internet systems 2003: OTM 2003 workshops : OTM confederated international workshops : HCI-SWWA, IPW, JTRES, WORM, WMS, and WSRM 2003, Catania, Sicily, November 3-7, 2003 : proceedings Authors: R. Meersman, Zahir Tari, Pages: 1071, Published: 2003
Auditing EDP Systems Authors: Donald A Watne, Peter B.B. Turney, Donald Watne, Pages: 0, Published: 2002
Multi-Agent Systems and Applications V: 5th International Central and Eastern European Conference on Multi-Agent Systems, CEEMAS 2007, Leipzig, Germany, September 25-27, 2007 : Proceedings Authors: Hans-Dieter Burkhard, Gabriela Lindemann, Rineke Verbrugge, Laszlo Z. Varga, Pages: 350, Published: 2007

Web:
Problems with Application Code and Controls - ASP.NET Forums Problems with Application Code and Controls. Last post 12-01-2005 6:38 PM by ryan.reid. 21 replies. Sort Posts: Oldest to newest, Newest to oldest ...
CodeProject: Docking ActiveX Controls: Principles and ... Aug 28, 2001 ... Besides the OLE part of control implementation, the main problem is to find the .... To be able to manage them from user application code, ...
Solving Performance Problems in an ASP.NET application with ANTS ... Part of my caching strategy involved storing sitemap-like data in a singleton tree class at application start. Many controls then rendered themselves, ...
Problems using application state with custom classes - ASP.NET General The problem comes in when I try to use the Application state from a custom ... Here is the code... Public Class _411Vars Inherits System.Web.UI.Page ... persist state of controls in a custom control, Teemu Keiski, ASP. ...
Problems running application in Eclipse (IDEs, Version Control and ... Aha, so this is an Eclipse problem. We finally get to the bottom of it. Again, the error you are seeing is not because of your code. ...

Could not find any resources appropriate for the specified culture ... data application block with asp.net- the timeout period elapsed prior to completion. ... problems with application code and controls ...
CodeVerge.Net Programming Forums Net 3.5 ListView is one new databound control that is shipped with ASP. ... Some are very serious security problems, while others will simply crash the server ... request on the server. the status code returned from the server was: 500 ( 4904) ... runtime error r6034, an application has made an attempt to load the c ...
Assembly Version Management - ng.asp-net-forum.migrating_from_asp ... web application project model versus website project model and migrating to 3.5 ยท problems with application code and controls ...
Trap Ctrl+Alt+Del - borland.public.delphi.nativeapi.win32 What about using Windows Policies to control things like that instead of ... >OS and cannot be overwritten in application code. A low-level keyboard hook ...
ModalPopup + Validation = JavaScript Error - asp.net_ajax.asp ... Code 0. Page: <%@ Control Language="vb" AutoEventWireup="false" ..... problems with emitting javascript with partial rendering rendering & update panels ...

Videos:
Coconut: COde CONstructing User Tool Google Tech Talks March, 7 2008 ABSTRACT Coconut is a developing system for high-assurance, high-performance software. It was used to ...
HITBSecConf2006 Malaysia : Marc Schonefeld - Pentesting Java/J2EE Presentation Title: Pentesting Java/J2EE - Discovering Remote Holes Presentation Details: Java/J2EE is a widely used industry standard for ...
Learning Defect Predictors from Static Code Attributes ... Google Tech Talks October 29, 2008 ABSTRACT For six years, I have worked on learning quality predictors from NASA data. Based on that ...
Igor Roman - Logging For Fun And Proffit Perl Programming Talks at YAPC::Braga When debugging a problem in an application, people generally resort to scattered print's throughout the ...
Using Grok to Walk Like a Duck PyCon 2008 Talk by Mr. Brandon C Rhodes (Georgia Tech) Grok provides tools for general-purpose application design. Reuse in Python often ...






asp:linkbutton mouse over messages in status bar

adding synamic sitemapnode

problem with a master page

treeview problems with childnodes depth

how can i hide/show a node(and childs) in a sitemap dynamically?

accessing dyanmic data on masterpage from content page

custom menu on a master page

access content placeholder from server code...

accessing contnet page's control in the javascript code of master page

css in content pages

treeview or panel? how to replicate asos.com main navigation

statichoverstyle not working

populating a treeview dynamically

asp:menu looks fine in ie7 but not in ie6

how to get the root parentnode at sitemap?

can i create the sitemap xml file visually without write xml?

previouspage of masterpage alway null

how do i update the content section of masterpage with ajax

simple button/image-based menu

treeview selectednode with sitemapdatasource

onmouseover events for treeview

site map

panel = contentplaceholder

treeview control populating from database

menu control - disappears in subpages

print content section

how to pull titles from db and sitemap at run time?

reference to js file in master page

how to reload an entire treeview with a callback?

changing theme programatically on a page with a drop down

   
  Privacy | Contact Us
All Times Are GMT