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?
LVL 11
HuaMin ChenSystem AnalystAsked:
Who is Participating?
 
Lokesh B RDeveloperCommented:
Hi,

1. Your Master Page is the common layout for all the pages.

2. Create the other pages with the ContentPlaceHolder and without setting the master page for each page seperately.

3. Set the MasterPage in web.config for all pages once.

Read this

https://msdn.microsoft.com/en-us/library/wtxbf3hh(v=vs.140).aspx
0
 
Lokesh B RDeveloperCommented:
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/
0
 
HuaMin ChenSystem AnalystAuthor Commented:
Thanks. But the name of the page within my current project, is called "Default.aspx". Should I change its name to "...Master"?
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
Lokesh B RDeveloperCommented:
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.
0
 
HuaMin ChenSystem AnalystAuthor Commented:
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?
0
 
HuaMin ChenSystem AnalystAuthor Commented:
Should I remove all contents of the current web page into the master page?
0
 
HuaMin ChenSystem AnalystAuthor Commented:
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?
0
 
Lokesh B RDeveloperCommented:
Hi,

You can't browse the masterpage in browser.
instead you need to browse the content page which is using that Site1.master.
0
 
Walter RitzelSenior Software EngineerCommented:
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.
0
 
David Johnson, CD, MVPOwnerCommented:
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
0
 
HuaMin ChenSystem AnalystAuthor Commented:
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?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.