compiler errors showing up only on dASP server

Discussion in 'ASP.NET 2.0' started by bhardmancom, Sep 6, 2007.

  1. Hi, I'm getting some trouble with a few pages in my site. There are a couple pages which the JITeriscomplaining about. These work fine on my local dev server. The first is a restricted page in a sub-folder. The error comes back saying that the master page can't be converted to Page:

    Compiler Error Message: CS0030: Cannot convert type 'ASP.page_master' to 'System.Web.UI.Page'

    Source Error:







    Code:
    Line 117:        
    Line 118:        public page_master() {
    Line 119:            ((Page)(this)).AppRelativeVirtualPath = "~/Page.master";
    Line 120:            if ((global::ASP.page_master.@__initialized == false)) {
    Line 121:                global::ASP.page_master.@__stringResource = this.ReadStringResource();
    I get a similar problem when the site tries to redirect a user to the login page:

    Compiler Error Message: CS0030: Cannot convert type 'ASP.login_aspx' to 'System.Web.UI.WebControls.Login'

    Source Error:







    Code:
    Line 118:        public login_aspx() {
    Line 119:            string[] dependencies;
    Line 120:            ((Login)(this)).AppRelativeVirtualPath = "~/login.aspx";
    Line 121:            if ((global::ASP.login_aspx.@__initialized == false)) {
    Line 122:                dependencies = new string[2];




    I'm kinda scratching my head here. This is obviously auto-gen code, and I can't understand why these casts don't work. If I try explicit casts of the same sort in my code locally, they work fine. Thinking this must have something to do with my security config, but not sure what...


    Any comments/suggestions would be welcome.





    /Brett
     
  2. You write your master page class like
    in aspx
    <%@ Master Language="C#" AutoEventWireup="true" CodeFile="Page.master.cs" Inherits="Page" %>

    in codebehinde
    public partial class Page : System.Web.UI.MasterPage
    {
    ....
    }

    Replace your class name "Page" with another name, for example "PageM" and write this name in inherite



    <%@ Master Language="C#" AutoEventWireup="true" CodeFile="Page.master.cs" Inherits="PageM" %>
    public partial class PageM : System.Web.UI.MasterPage
    {
    ....
    }

    It's needed because name "Page" as and name "LoginPage" conflicted with System.Web namespace that have same classes.

    Good luck!
     

Share This Page