Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have a Master page which needs to inherit from a class (MasterPage2.cs) stored inside "App_Web_yht1mma2" folder.

In the master page, I have set the code as:

C#
<%@ Master Language="C#" AutoEventWireup="true" Inherits="MasterPage2,App_Web_yht1mma2" %>


When I debug this page, I receive the following error:


XML
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 the assembly 'App_Web_yht1mma2'. Make sure that it is compiled before accessing the page.
    
    Source Error:
    
    Line 1:  <%@ Master Language="C#" AutoEventWireup="true" Inherits="MasterPage2,App_Web_yht1mma2" %>
    Line 2:
    Line 3:
    
    Source File: /MasterPage.master    Line: 1


Kindly advise me on how to correct this error.
Posted
Comments
Suvabrata Roy 4-Jul-14 9:06am    
why you are going to provide that assembly name in Inherits part ?
tancliffe 4-Jul-14 9:29am    
Kindly elaborate your comment. I'm new to this coding please
Suvabrata Roy 4-Jul-14 9:32am    
Look you don't need to specify the Assembly name in inherits you just need to mention the name space.

and which Assembly name you specified that will create after you run the application.
you have choose a web site project so just remove the App_Web_yht1mma2 and specify the namespace
tancliffe 4-Jul-14 9:38am    
Okay, so would namespace in this case be "MasterPage2"? If I do this and compile: <%@ Master Language="C#" AutoEventWireup="true" Inherits="MasterPage2" %>, I still get this error "Parser Error Message: Could not load type 'MasterPage2'."
Suvabrata Roy 4-Jul-14 9:47am    
Yes I think so for better understanding : http://msdn.microsoft.com/en-us/library/vstudio/wtxbf3hh(v=vs.100).aspx

1 solution

try this below code but first you need to compile App_Web_yht1mma2 assembly..

VB
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="MainMasterPageWeb.Master.cs"
    Inherits="App_Web_yht1mma2.MasterPage2" %>
 
Share this answer
 
Comments
tancliffe 5-Jul-14 9:25am    
Thank you very much for the help. Using this idea, I managed to write the code below which worked for me:

"<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage2" %>
"
purvivani 5-Jul-14 11:23am    
wc

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900