Aspx Page Doesn't Compile When Page Is Copied From Another Project?
Feb 22, 2010
I often have an issue with compile errors when I copy over a aspx page and code behind file from another project, it seems to work when I create another page and the content manually but if I just copy the files it won't. I have checked to make sure namespaces and references are ok but still doesn't make any sense. The error I get is "Error The name 'txtUser' does not exist in the current context". I just wanted to understand why.
I have a Perl script that calls aspnet_compiler.exe to compile a large ASP.NET website. The problem is that it takes very long to run. Is there any way to compile just a single .aspx file from the command line? (I think that would suit the needs of my script) It seems that all aspnet_compiler.exe can do is compile at a directory level.
I have a VS 2008 solution. I need to copy an existing .aspx page and re-name it to something else (need to make modifications to that newly copied page). But I keep getting compilation errors saying that duplicate text boxes exist. Can't I have control on different .aspx pages with the same name? How can I do this elegantly?
As that title says my aspx page shows a compile error on the @Page directive that says "ASP.NET runtime error: Cannot load file or Assembly 'Microsoft.SqlServer.BatchParser' or one of it's dependencies". The project compiles with our error and it runs with no problem. The only real problem that this causes it that the intellisense for anything other than simple HTML is broken so I can't type asp:Controlname and have intellisense show me a the list of items or properties in a control. I get a green squiggly line under all the asp tags saying "Unrecognized tag prefix or device filter 'asp'". This project doesn't directly use SQL SMO but it does reference a project that does. However, I removed that reference and the problem still doesn't go away. I have installed on my development machine the full SQL client and for both SQL 2005 and 2008 (including the SDK) from the Developer editions of both versions. This was not a problem on VS2005 and the project compiles without error in VS2010 too.
I'm using ASP.NET with VB, and .NET version 3.5. In the project, I've got some utility functions that I call from expressions in the aspx pages and also in code behind. This all works fine on my local machine, but when I deploy to the production server, I get this compilation error on each of those utility methods:
BC30456: 'XXX' is not a member of 'String'.
where XXX is an extension method defined on System.String. I'm baffled about this for a number of reasons:
Why is ASP.NET compiling anything at all, since I've precompiled the application and put everything in the bin directory. ASP.NET knows the functions are there because they work in code behind. It's only when used in the aspx page that I have this problem. (e.g. if I do something like this: <%= "A string to XXX-ify".XXX())%>) This method is public, which I verified with Reflector. I imported the relevant namespaces in the web.config file, and I can see that these namespaces are being imported in the call that ASP.NET makes to the compiler.
We're migrating from the web site to the web application model. Is there a way to allow the designer to use ftp to upload a single aspx page (foo.aspx and foo.aspx.cs) without requiring the use of the VS2008 Publish feature? We're a small shop and haven't bothered using source control as it wasn't much of an issue with the web site model. If the designer uses the Publish feature my binaries will be overwritten. I know that static pages are compiled at run time so I thought this would be possible but my tests result in errors. I've clicked around for some guidance but come up empty handed.
I am maintaining a web site project in VS2005 and have to call a new web service on a remote server. I've done add web reference, and created the .wsdl and .discomap files in the app_webReference folder. When I try to create a object representing the web service in the code ( wsnamespace.serviceName ws = new wsnamespce.serviceName(); ) the code wouldn't compile.
The web site project is already calling other web services. When I right click on the type representing the web service and "go to definition" it takes me to a proxy class (derived from of course SoapHttpClientProtocol) in the metadata. I think this is what's missing for the new web service i'm trying to call. Have I missed any steps?
I migrating a large asp.net webform site to MVC. I want to mix match old asp.net web form and asp.net mvc together for sometime and gradually convert the webform model to pure mvc model.
So i copied all aspx/ascx files from the old webform site to my mvc project. Now when i compile, i get build error. Code behind files can not find any server controls inside their aspx pages.
I can solve this problem by adding a desinger.cs file for each of the aspx,ascx file but that simply is not viable for me since i am dealing with hundreds of aspx pages and user controls and i can not afford to manually add a designer file for each of them.
I have a large folder (1.5 GB) in my ASP.NET Web Site, called Downloads, which contains media files, graphics, etc. No code that needs to be compiled or even deployed on every build.
I use Web Deployment Projects to compile and deploy. Every time I build the deployment project, the Downloads folder gets included and copied to the output location. This is taking a significant amount of time, because the folder is copied twice.
The problem is that for any other TextBox on the page which is using this MasterPage, for example the login page, if you type your user name and password and hit Enter, The page is redirected to the SearchPage. If you click on login buttton everything works fine. How do I make sure hitting enter on the page in any other text box does not post back to SearchPage.aspx?
I've encountered a problem when I put a treeview in a page which is using master page. The treeview style doesn't apply.For example, I set the nodes with different colors in different levels. But the treeview nodes are still displayed in the default color(bule).
The treeview code is :
If I use these code in a page which doesn't use a master page. The nodes are shown in colors.
How can I call a public property declared on a ASPX page from a different ASPX Page? Is that possible? It is a website project. How can I get/call this property from a different aspx page? I have attempted this from the other page, but it is not recognizing the partial class: private Test_Default _test; It does not recognize the "Test_Default"
I have been using LINQ to SQL for quite a while (about two years). Every thing was fine until now. As usual, I created LINQ to SQL classes and built the project, then created an aspx page. However, I cannot see the DataClassesDataContext in the code behind file. It is not listed in the intellisense list.
How do I compile an ASP.Net MVC project using MSBuild? We use a Continuous Integration server to compile and deploy our applications. To keep things simple I created an MVC 1.0 project in VS2008. I immediately created an MSBuild script file to compile it. I did not change any code in the project. The MSBuild script contained the following target.
The MVC project sln file is contained in the c:developmentmvc1 directory.I am running XP/Pro.I am receiving an error ASPCONFIG: it is an error to use a section registered as allowDefintion='MachineToApplication' beyond application level.
I removed the authenication mode, membership provider, etc. from the web config file until I finally saw a different error message.I am now receiving an error message saying that the file '/views/shared/site.master' does not exist.
I've noticed that my project builds successfully when I hit F6.But when I run it with F5 the compilation errors in my C# surface.Why is this?Is it because the JIT compilation happens when I debug with F5 but not when I build with F6?
I have the book ASP.NET 3.5 WEB SITE. I can't get the view/edit employee to work. (Chapter 10) I have copied the code from the "download chapters" and it still doesn't work. Am I missing something? I don't see where there were typos on this chapter
Is it possible to compile a web application project .ascx (user control) into a dll?I want to do the following:Use the same control in multiple websitesEmbed css and .js as resources into the controlBe able to update super easy. If the user control updates, I just want to update 1 .dllI have successfully followed this article, [URL]However, that uses web site projects, and I cannot embed js css as resources into web site projects.
Is to possible to make a configuration entry (web.config). That automatically compiles a referenced project(for example a class library) when the site runs? This would be easier for me to maintain on my hosting server. Otherwise i have to always recompile the files and upload them again for every small change.