Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Master Pages in sub directories

Posted on 2012-12-21
23
Medium Priority
?
601 Views
Last Modified: 2012-12-24
I have a program that uses a Master Page on the main level and also the same Master page is used on sub levels.  Hopefully a picture is worth a thousand words.
This is the directory structure If I run the program locally (on my machine) it works fine, but if I publish it to the test site it receives errors. Again a picture is worth a thousand words.

This is what the page looks like.The Error File
Any Ideas?
0
Comment
Question by:us1975mc
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 12
  • 7
  • 3
  • +1
23 Comments
 
LVL 34

Expert Comment

by:Paul MacDonald
ID: 38714122
Try
... MasterPageFile="/Master.Master" ...
0
 

Author Comment

by:us1975mc
ID: 38714135
Same thing...
Basicially the same error...
0
 
LVL 34

Expert Comment

by:Paul MacDonald
ID: 38714144
Oh, maps to another application.  The subdirectory has it's own web.config, etc.  

You'll need to copy the Master.Master file to the subfolder, I'm sure.  You might get away with creating a shortcut there, but the reference will have to be within the application.
0
Fill in the form and get your FREE NFR key NOW!

Veeam® is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

 

Author Comment

by:us1975mc
ID: 38714279
Still no go...
I placed a Master Page named Tech.Master in the Tech Folder.  I also set MasterPageFile="Tech.Master" in the Default page in the tech folder.  and I get this eror...
0
 
LVL 34

Expert Comment

by:Paul MacDonald
ID: 38714292
Is there a class in Tech.Master called "ITrack_Web.Tech"?
0
 

Author Comment

by:us1975mc
ID: 38714310
This is in the Tech>Master:
<%@ Master Language="VB" AutoEventWireup="false" CodeBehind="Tech.Master.vb" Inherits="ITrack_Web.Tech" %>

Open in new window


And this is in the Tech.Master.vb:
Public Class Tech

Open in new window


The Project name is ITrack_Web.  

Not really how to get the ITrack_Web into the Public Class Tech.  When I place the ITrack_Web.Tech the Tech gets the squiggly blue line.
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 38714355
Does it work if you put

MasterPageFile="../Master.Master"
0
 

Author Comment

by:us1975mc
ID: 38714369
Have tried "../Master.Master", "~/Master.Master", "/../Master.Master", "~/../Master.Master".  

Strange that it works from my local machine but not on the server.
0
 
LVL 34

Expert Comment

by:Paul MacDonald
ID: 38714482
Change Tech.Master so it starts with...
<%@ Master Language="VB" AutoEventWireup="false" CodeBehind="Tech.Master.vb" Inherits="Tech" %>

Note that if you have anothe rpage (something.vb) with the class "Tech" you'll throw another error.
0
 

Author Comment

by:us1975mc
ID: 38714495
Still error.Do I need to place the Tech Master in the root folder?
0
 
LVL 34

Expert Comment

by:Paul MacDonald
ID: 38714508
Okay, one more time.

In Tech.Master:
<%@ Master Language="VB" AutoEventWireup="false" CodeBehind="Tech.Master.vb" Inherits="Tech_Master" %>

In Tech.Master.vb:
Partial Class Tech_Master

Both files should be in your Admin folder (at least that's the folder we were working in initially).
0
 

Author Comment

by:us1975mc
ID: 38714563
Error #4This is the directory setup.Enclosed is a diagram of what I am working with.  I still get an error with changing to Tech_Master.

In the directory setup I left out that I have a Webconfig in each of the directories Admin, Tech, and User.  I really was wanting to use the Master.Master page that is in the root directory on all of the pages in the Project.  

I guess the question is can I use a master page that is in the root level when in the sub directories I have a full program that has its own webconfig, but is also using the root level webconfig?

Thanks everyone.
0
 
LVL 34

Expert Comment

by:Paul MacDonald
ID: 38714790
"I still get an error with changing to Tech_Master."
The screenshot shows Inherits="Tech"

In any case, I had originally suggested just copying the Master.Master into each subfolder.

Alternately, you can try creating a shortcut to the Master.Master in each subfolder.
0
 
LVL 16

Expert Comment

by:Vikram Singh Saini
ID: 38718529
Hi us1975mc,

After reading the entire discussion between experts and you, I tried developing web application and test it on my development server.

First of all let me share with you my findings.

1. Developed Web Application named as MasterInSubdir with Default.aspx and MasterPage.master in root folder. In Admin folder, there is file Default.aspx page with MasterPageFile set to master file (in root).

2. Then I hosted it directly in virtual directory test on IIS 5.1 . In browser I entered http://localhost/test. I expected it to show me Default.aspx page simply. But the output was asp.net yellow error page. The error was something as:

Server Error in '/test' Application.

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 type 'MasterInSubdir.SiteMaster'.

Source Error: 

Line 1:  <%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="MasterInSubdir.SiteMaster" %>
Line 2:  
Line 3:  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

Source File: /test/Site.master    Line: 1 

Open in new window


Question: Why? So in search of solution I tried deleting temporary files, rechecked code and tested again. No! It didn't worked.

3. Then? Keeping try for solution, I build the entire web application from VS 2010 only. It generated MasterInSubdir.dll in bin folder within root folder (i.e. MasterInSubdir).

Now I tested the http://localhost/test and http://localhost/test/Admin/Default.aspx. Wow! This time both run fine as expected.

As second round of testing, I deleted that generated .dll file from bin folder and tested web app. Fantastic! It showed me the same type of error message again.

CONCLUSION:
You are facing error because of either of following reasons:

1. You done some changes in web application and then published the web application without building it locally. I'm just trying to explain (as you know I'm not so much hosting expert). So the .dll files not updated.

2. Or you published web application from scratch, but not build the web application from VS 2010.

So my suggestion: Remove or delete the entire hosted files (if possible). Build your web application from VS IDE. Confirm if the .dll file named per your web application is showing in bin folder. Then publish your web application on test site. Test it. I believe it should work now as all stuff is available for making it to run.
0
 

Author Comment

by:us1975mc
ID: 38718560
vs00saini WOW!

I just read through your comments and have that I will need to read through it several more times.  I appreciate the time and effort that you have placed in my question.

Question:  When you state "You done some changes in web application and then published the web application without building it locally", I am not sure what you mean by locally. What I usually do (not to say that this is correct) but periodically I try posting the code to the Test site. In doing this I go to Build and Press Publish web-App.  Is there a step that I am missing?
0
 

Author Comment

by:us1975mc
ID: 38718579
Maybe I didn’t really clarify myself.  I have this program with Master.Master in the root and also a Default.aspx in the root.  Then I have three sub directories, that each are working programs, and they each have a Default.aspx page in them that uses the Master.Master in the root directory.  On my locao machine the program works flawlessly.  It is only when I publish the program that I start getting errors.  

I can see the master page and all pages in the root directory when I publish.  It is only the programs in the sub directories that error out.
0
 

Author Comment

by:us1975mc
ID: 38718584
paulmacd,

How do I go about creating a shortcut to the Master.Master in each subfolder?
0
 
LVL 16

Assisted Solution

by:Vikram Singh Saini
Vikram Singh Saini earned 1000 total points
ID: 38718775
Hi,

Please ignore my previous comment as it was based on some sort of my technical knowledge assumptions.

Now I give try for publishing demo web application in sub directory of my website http://www.vss-tech.com/test.

At first, it failed with same message as you experienced. But later on I changed the published Default.aspx page's page directive from:

<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeBehind="Default.aspx.cs" Inherits="MasterInSubdir.Default" %>

Open in new window


to

<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/test/Site.master" AutoEventWireup="true"
    CodeBehind="Default.aspx.cs" Inherits="MasterInSubdir.Default" %>

Open in new window


Notice the MasterPageFile attribute and it started working fine.

So for your case, I would suggest you to change your code in Default.aspx something as:

<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/rootFolderName/Master.master
    CodeBehind="Default.aspx.vb" Inherits="ITrack_Web._Default1" %>

Open in new window


Change the code path MasterPageFile="~/rootFolderName/Master.master as per your root folder name. I guess it would be MasterPageFile="~/ITrack Web/Master.master.

Let us know your testing result. If you are publishing, and if it's not so much personally, you can share your link for testing.
0
 

Author Comment

by:us1975mc
ID: 38718900
vs00saini,

I wished that I could let you look at the code but I am not able to do that for business reasons. ( Bah Humbug)

I do appreciate the help that everyone has been giving.  Thanks and I am still working on this...
0
 
LVL 16

Expert Comment

by:Vikram Singh Saini
ID: 38718948
Hi,

That's no issue. We all are restricted to share something due to different reasons. And it's not necessary to share. I just asked for helping you. Please ignore that part.

However I would like to know your testing result as I asked for.
0
 

Author Comment

by:us1975mc
ID: 38718995
I believe that I have found the problem.  I have the 3 subfolders set up as a seperate application. When I place a Master page in each of the folders and get rid of the main level they seem to work properly.  So I am currently working on changing the Master pages around to see if that work for all of the pages.
0
 
LVL 34

Accepted Solution

by:
Paul MacDonald earned 1000 total points
ID: 38719048
Yes!

"Oh, maps to another application.  The subdirectory has it's own web.config, etc.  

You'll need to copy the Master.Master file to the subfolder, I'm sure.  You might get away with creating a shortcut there, but the reference will have to be within the application.
"

Does the root of your application not require a Master page?  Make sure you test it before leaving the root without one...
0
 

Author Closing Comment

by:us1975mc
ID: 38719112
I should have known, but it worked on my machine locally.  Placing in each application will do the job.  

Have learned a lot from both of you on this question.  Everything that I know is from being self taught and Experts Exchange has been a great help when all seams lost.  

Thanks to all for the help!

Semper Fidelis,

us1975mc
0

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question