Avatar of Peter Chan
Peter Chan
Flag for Hong Kong asked on

Problem to master page

Hi,

Any advice to this problem?

Server Error in '/Start_dev' Application.

Configuration Error

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. 

Parser Error Message: Master page source files must have a .master file extension.

Source Error: 


Line 17:     </connectionStrings>
Line 18:     <system.web>
Line 19:       <pages masterPageFile="~\Default.aspx" />
Line 20:       <customErrors mode="Off"/>
Line 21:       <compilation targetFramework="4.5" />

Source File: C:\inetpub\VS2012\Start_dev\web.config    Line: 19 

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34237

Open in new window

And the original problem is due to that, I need to use

ContentPlaceHolder

Open in new window


on the .aspx page. How to resolve the problem?
.NET ProgrammingScripting LanguagesWeb Development Software

Avatar of undefined
Last Comment
Peter Chan

8/22/2022 - Mon
Lokesh B R

Hi,

You need give the MasterPage Name in  web.config file so that all the content pages will take the master page.

If no content tags the normal web page.

<pages masterPageFile="~/MasterPage.Master />

More Info
http://www.c-sharpcorner.com/UploadFile/abhikumarvatsa/creating-master-page-in-Asp-Net-part-5/
Peter Chan

ASKER
Thanks. But the name of the page within my current project, is called "Default.aspx". Should I change its name to "...Master"?
Lokesh B R

Hi,

You need to have the MasterPage in your application and set that in web.config.

If you don't have the master page create the new one and set that name in config.

You can't give the web page as master page.
Your help has saved me hundreds of hours of internet surfing.
fblack61
Peter Chan

ASKER
Does it mean I should put

ContentPlaceHolder

Open in new window


inside the master page? Then it means I cannot continue to use the current web page for "ContentPlaceHolder" and should I put all contents of the current web page into the master page?
Peter Chan

ASKER
Should I remove all contents of the current web page into the master page?
ASKER CERTIFIED SOLUTION
Lokesh B R

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Peter Chan

ASKER
Sorry, when I change to use Master page instead. I did encounter this

Server Error in Application "VS2012/START_DEV"
Internet Information Services 7.5
Error Summary
HTTP Error 404.7 - Not Found
The request filtering module is configured to deny the file extension.
Detailed Error Information
Module	RequestFilteringModule
Notification	BeginRequest
Handler	StaticFile
Error Code	0x00000000
Requested URL	http://192.168.168.1:80/Start_dev/Site1.Master
Physical Path	C:\inetpub\VS2012\Start_dev\Site1.Master
Logon Method	Not yet determined
Logon User	Not yet determined
Most likely causes:
Request filtering is configured for the Web server and the file extension for this request is explicitly denied.
Things you can try:
Verify the configuration/system.webServer/security/requestFiltering/fileExtensions settings in applicationhost.config and web.config.
Links and More Information
This is a security feature. Do not change this feature unless the scope of the change is fully understood. If the file extension for the request should be allowed, remove the denied file extension from configuration/system.webServer/security/requestFiltering/fileExtensions.
View more information »

Open in new window


why?
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Lokesh B R

Hi,

You can't browse the masterpage in browser.
instead you need to browse the content page which is using that Site1.master.
Walter Ritzel

HuaMinChen,
your problem is simple: Default.aspx is not the correct name for a master page. If Default.aspx is not your master page, please put the name of it there. If it is, please rename it to Default.master for example and correct your web.config.

And please, read all the links provided by the other experts.
David Johnson, CD

if you look at the code of your default.aspx you should see something like the following:
<%@ Page Title="Home Page" Language="VB" MasterPageFile="~/Site.Master" AutoEventWireup="false"
    CodeFile="Default.aspx.vb" Inherits="_Default" %>
site.master has the following first line
<%@ Master Language="VB" AutoEventWireup="false" CodeFile="Site.Master.vb" Inherits="Site" %>

web.config has nothing about the master page
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
Peter Chan

ASKER
instead you need to browse the content page which is using that Site1.master.

Can I have more details for doing this?

Since I have to use one

ContentPlaceHolder

and this is why I need Master page, how to adjust the project now?