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 12
HuaMin ChenProblem resolverAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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 ChenProblem resolverAuthor Commented:
Thanks. But the name of the page within my current project, is called "Default.aspx". Should I change its name to "...Master"?
0
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
Why Diversity in Tech Matters

Kesha Williams, certified professional and software developer, explores the imbalance of diversity in the world of technology -- especially when it comes to hiring women. She showcases ways she's making a difference through the Colors of STEM program.

HuaMin ChenProblem resolverAuthor 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 ChenProblem resolverAuthor Commented:
Should I remove all contents of the current web page into the master page?
0
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
HuaMin ChenProblem resolverAuthor 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 ChenProblem resolverAuthor 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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.