Link to home
Start Free TrialLog in
Avatar of spaceneedlejumper
spaceneedlejumper

asked on

Why does Default.aspx suddenly generate compilation errors?

I'm working on a site.  Without making any changes to Default.aspx or Default.aspx.vb I suddenly get a compilation error.  These two files have ALWAYS worked properly.  The site builds without errors but will not show the Default.aspx page because of the error in the .vb file for that page.

I have already tried deleting the files and creating new ones by pasting the content back into them and leaving the autogenerated lines alone.  Even these new files create the error.

Obviously this is a show stopper.

I have attached a screenshot of the error and Default.aspx and Default.aspx.vb files.

Please help
********************  BEGIN CODE FOR DEFAULT.ASPX *******************
 
<%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" title="Untitled Page" %>
 
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="information" Runat="Server">
 
Mountlake Terrace Hall (MLT), Room 130
<br /><br />
(425) 640-1256 " careeractioncenter@edcc.edu
<br /><br />
Fax: (425) 640-1121
 
<br /><br />
<br /><br />
 
<table width="600px" border="0" cellpadding="5" cellspacing="0">
<tr>
    <td width="25px">&nbsp;</td>
    <td width="250px" bgcolor="#0066CC" valign="top">
        <strong>Are you a student?</strong>
        <br /><br />
        To search for a job or internship 
        <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/StudentDefault.aspx">create a profile here </asp:HyperLink>
        and get going.
        <br /><br />
        <asp:HyperLink ID="HyperLink2" runat="server"></asp:HyperLink>
        View resources available for your job search.
    </td>
    <td width="50px">&nbsp;</td>
    <td width="250px" bgcolor="#0066CC" valign="top">
        <strong>Are you an employer?</strong>
        <br /><br />
        <asp:HyperLink ID="HyperLink3" runat="server" NavigateUrl="~/EmployerDefault.aspx">Post jobs and internships here.</asp:HyperLink>
        <br /><br />
        <asp:HyperLink ID="HyperLink4" runat="server"></asp:HyperLink>
        Other opportunities for businesses.
    </td>
    <td width="25px">&nbsp;</td>
</tr>
</table>
</asp:Content>
 
********************  END CODE FOR DEFAULT.ASPX *******************
 
 
********************  BEGIN CODE FOR DEFAULT.ASPX.VB *******************
 
Partial Class _Default
    Inherits System.Web.UI.Page
 
End Class
 
********************  END CODE FOR DEFAULT.ASPX.VB *******************

Open in new window

CompilationError.gif
Avatar of Lotok
Lotok
Flag of United Kingdom of Great Britain and Northern Ireland image

On the default.aspx page do you have a line under the page declaration (The part quoted below)?
I have had similar problems and pressing enter to add a line break and then backspace to remove it again fixes it.

<%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" title="Untitled Page" %>

Open in new window

Avatar of spaceneedlejumper
spaceneedlejumper

ASKER

There was a blank line under the page declaration.

I went to the end of the page declaration line and hit return, saved the file, built it and got 21 errors.

I deleted the extra blank line (bringing me back to one blank line as before), built it and got 21 errors.

I deleted all blank lines under the page declaration, built it, and got 21 errors.

All errors are in a temporary file called App_Web__c6oqfpo.14.vb

Error List ***********************
Error      13      '_Default' is ambiguous.      C:\Users\Travis\AppData\Local\Temp\Temporary ASP.NET Files\employers\b3538e41\13af8f55\App_Web__c6oqfpo.14.vb      78      
Error      14      Class 'default_aspx' must implement 'ReadOnly Property IsReusable() As Boolean' for interface 'System.Web.IHttpHandler'. Implementing property must have matching 'ReadOnly' or 'WriteOnly' specifiers.      C:\Users\Travis\AppData\Local\Temp\Temporary ASP.NET Files\employers\b3538e41\13af8f55\App_Web__c6oqfpo.14.vb      79      
Error      15      Class 'default_aspx' must implement 'Sub ProcessRequest(context As HttpContext)' for interface 'System.Web.IHttpHandler'.      C:\Users\Travis\AppData\Local\Temp\Temporary ASP.NET Files\employers\b3538e41\13af8f55\App_Web__c6oqfpo.14.vb      79      
Error      16      'ReadStringResource' is not a member of 'ASP.default_aspx'.      C:\Users\Travis\AppData\Local\Temp\Temporary ASP.NET Files\employers\b3538e41\13af8f55\App_Web__c6oqfpo.14.vb      97      
Error      17      'GetWrappedFileDependencies' is not a member of 'ASP.default_aspx'.      C:\Users\Travis\AppData\Local\Temp\Temporary ASP.NET Files\employers\b3538e41\13af8f55\App_Web__c6oqfpo.14.vb      103      
Error      18      'Server' is not a member of 'ASP.default_aspx'.      C:\Users\Travis\AppData\Local\Temp\Temporary ASP.NET Files\employers\b3538e41\13af8f55\App_Web__c6oqfpo.14.vb      106      
Error      19      property 'SupportAutoEvents' cannot be declared 'Overrides' because it does not override a property in a base class.      C:\Users\Travis\AppData\Local\Temp\Temporary ASP.NET Files\employers\b3538e41\13af8f55\App_Web__c6oqfpo.14.vb      109      
Error      20      'HyperLink1' is not a member of 'ASP.default_aspx'.      C:\Users\Travis\AppData\Local\Temp\Temporary ASP.NET Files\employers\b3538e41\13af8f55\App_Web__c6oqfpo.14.vb      133      
Error      21      Value of type 'ASP.default_aspx' cannot be converted to 'System.Web.UI.TemplateControl'.      C:\Users\Travis\AppData\Local\Temp\Temporary ASP.NET Files\employers\b3538e41\13af8f55\App_Web__c6oqfpo.14.vb      134      
Error      22      Value of type 'ASP.default_aspx' cannot be converted to 'System.Web.UI.Page'.      C:\Users\Travis\AppData\Local\Temp\Temporary ASP.NET Files\employers\b3538e41\13af8f55\App_Web__c6oqfpo.14.vb      135      
Error      23      'HyperLink2' is not a member of 'ASP.default_aspx'.      C:\Users\Travis\AppData\Local\Temp\Temporary ASP.NET Files\employers\b3538e41\13af8f55\App_Web__c6oqfpo.14.vb      163      
Error      24      Value of type 'ASP.default_aspx' cannot be converted to 'System.Web.UI.TemplateControl'.      C:\Users\Travis\AppData\Local\Temp\Temporary ASP.NET Files\employers\b3538e41\13af8f55\App_Web__c6oqfpo.14.vb      164      
Error      25      Value of type 'ASP.default_aspx' cannot be converted to 'System.Web.UI.Page'.      C:\Users\Travis\AppData\Local\Temp\Temporary ASP.NET Files\employers\b3538e41\13af8f55\App_Web__c6oqfpo.14.vb      165      
Error      26      'HyperLink3' is not a member of 'ASP.default_aspx'.      C:\Users\Travis\AppData\Local\Temp\Temporary ASP.NET Files\employers\b3538e41\13af8f55\App_Web__c6oqfpo.14.vb      182      
Error      27      Value of type 'ASP.default_aspx' cannot be converted to 'System.Web.UI.TemplateControl'.      C:\Users\Travis\AppData\Local\Temp\Temporary ASP.NET Files\employers\b3538e41\13af8f55\App_Web__c6oqfpo.14.vb      183      
Error      28      Value of type 'ASP.default_aspx' cannot be converted to 'System.Web.UI.Page'.      C:\Users\Travis\AppData\Local\Temp\Temporary ASP.NET Files\employers\b3538e41\13af8f55\App_Web__c6oqfpo.14.vb      184      
Error      29      'HyperLink4' is not a member of 'ASP.default_aspx'.      C:\Users\Travis\AppData\Local\Temp\Temporary ASP.NET Files\employers\b3538e41\13af8f55\App_Web__c6oqfpo.14.vb      212      
Error      30      Value of type 'ASP.default_aspx' cannot be converted to 'System.Web.UI.TemplateControl'.      C:\Users\Travis\AppData\Local\Temp\Temporary ASP.NET Files\employers\b3538e41\13af8f55\App_Web__c6oqfpo.14.vb      213      
Error      31      Value of type 'ASP.default_aspx' cannot be converted to 'System.Web.UI.Page'.      C:\Users\Travis\AppData\Local\Temp\Temporary ASP.NET Files\employers\b3538e41\13af8f55\App_Web__c6oqfpo.14.vb      214      
Error      32      function 'GetTypeHashCode' cannot be declared 'Overrides' because it does not override a function in a base class.      C:\Users\Travis\AppData\Local\Temp\Temporary ASP.NET Files\employers\b3538e41\13af8f55\App_Web__c6oqfpo.14.vb      354      
Error      33      sub 'ProcessRequest' cannot be declared 'Overrides' because it does not override a sub in a base class.      C:\Users\Travis\AppData\Local\Temp\Temporary ASP.NET Files\employers\b3538e41\13af8f55\App_Web__c6oqfpo.14.vb      359      
ASKER CERTIFIED SOLUTION
Avatar of sunithnair
sunithnair

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Press enter before the declaration so it is moved down a line.
Do you have a coloured line under that line of text?
Hi Lotok,

I moved the declaration down one line and got the same errors.  The line below the declaration line contains nothing.... like this...  If the declaration line appears here at experts exchange as being on one line, that is only here.  In the program it is all on one line.


<%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" title="Untitled Page" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
Hello sunithnair,

I used the Rebuild option as you suggested and it successfully eliminated the 21 errors that occur during the build process, however, it returned me to the Compilation Error exactly as I described at the beginning of this post.

There is a huge amount of files in the C:\Users\Travis\AppData\Local\Temp\Temporary ASP.NET Files directory and none of them modified more recently than November of 2008 - hard to believe, but that's what it says.

Do you still think I should try deleting these files?
Sunithnair and Lotok,

OK..... Now it's working.  It's not returning me to the original Compilation Error message.

I don't know why it's working.  I would think it had to to with the Rebuild suggestion that sunithnair made, although when I did that I still got the original error message.  Now it's just suddenly working.

Maybe it is putting the page declaration on line 2.

I just wish the thing would be consistent and not arbitrarily stop working from time to time.  As I said, these files have been working for a long time and stopped for no apparent reason tonight.
There is no harm in deleting those files because it will get recreated when you build your solution again. If that does not solve the problem try renaming your class to something other than _Default or put that inside a namespace and refer the class from your aspx page using the namespace
The problem may be because you are still developing the site and there are many temporary files created when you keep changing your code. I dont think it will happen in the production.
Sunithnair,

I deleted the files in the temp directory.

Thank you for your help.  I am closing this question.

Travis
When I first implemented this solution it returned me to my original error.  Then for some reason when I navigated to the page that had the compilation error, there was no error on that page.  So I stopped debugging and built the site again as I normally would and there was no error.  Therefore, I'm not absolutely certain that this solution was the answer but it seems likely that it may have been.