Link to home
Start Free TrialLog in
Avatar of Peter Chan
Peter ChanFlag 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?
Avatar of Lokesh B R
Lokesh B R
Flag of India image

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/
Avatar of 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"?
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.
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?
Should I remove all contents of the current web page into the master page?
ASKER CERTIFIED SOLUTION
Avatar of Lokesh B R
Lokesh B R
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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?
Hi,

You can't browse the masterpage in browser.
instead you need to browse the content page which is using that Site1.master.
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.
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
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?