Ryan
Ryan

Reputation: 3492

Master Page getting Could Not Load Type error when publishing

Everything works find locally, but when I publish my asp.net application to a remote server I get the following error:

Server Error in '/' Application.

Parser Error

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. 

    Parser Error Message: Could not load type 'JournalPages.MasterMain'.

    Source Error: 

    Line 1:  <%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Main.master.cs" Inherits="JournalPages.MasterMain" %>
    Line 2:  
    Line 3:  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

Source File: /journalpages/Main.Master    Line: 1 

This happens on any page with a master page. I used Reflector to look at the assembly in the bin directory and the types are all there. Any ideas??

Upvotes: 4

Views: 25311

Answers (7)

cahit beyaz
cahit beyaz

Reputation: 5127

In my case problem occured when I renamed masterpage. To solve I have to correct inherits in the Masterpage

Inherits="Namespace.MasterpaseClassName"

Upvotes: 0

Randell
Randell

Reputation: 1

I had this same problem. Only to find from comparing older sites I had built with earlier version of VS.... VS now uses "CodeBehind" in place of "CodeFile"...so I just search and replaced all the "CodeBehind" with "CodeFile" and poof it worked

(This is on GoDaddy)

Hope this helps

Upvotes: 0

Ghanshyam Tarsariya
Ghanshyam Tarsariya

Reputation: 21

You only need to exchange ~/ by .\

example :

wrong :MasterPageFile="~/CMaster.master"
right :MasterPageFile=".\CMaster.master"

Upvotes: 1

D. Arcand
D. Arcand

Reputation: 11

I have the same problem. Just copy 'JournalPages.MasterMain.ca' and 'JournalPages.MasterMain.designer.cs' in you virtual folder, fix the problem.

Upvotes: 1

Shri
Shri

Reputation: 21

If you are generating a web setup and trying to test it by making installation then make sure that output files such as (Ui dll and its supporting dlls) are available in the BIN folder.

Upvotes: 2

Ryan
Ryan

Reputation: 3492

Ok it turns out they hadn't set up the site folder in IIS to be an Application. Once they did all worked well.

Upvotes: 4

Walter
Walter

Reputation: 2560

Sounds to me like the web site in IIS is set to use .NET 1.1. Go to the properties page of the web site in IIS, then click on the ASP.NET tab. My bet is that the version says 1.1.4322

Upvotes: 0

Related Questions