Iis virtual directory and masterpages

L

lee atkinson

HI guys, got a bit of a problem here... No joy from google.

Ive got a website vb.net 2005 , with a masterpage In the root... Ive got
some pages in a folder like /root/sections/subsectionfiles/page.aspx ...
With the reference to the masterpage as <%@ Page Language="VB"
MasterPageFile="~/master.master" ... This all works cool.

Im trying to add some virtual directorys that point to the 'subsection'
folder like so -

/root/section/section1/
/root/section/section2/
/root/section/section3/

And these folders map to 'subsectionfiles' folder in IIS ... So I thought
this would work fine but when i browse '/root/section/section1/' it throws
this error -


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: The file '/sections/subsectionfiles/master.master'
does not exist.

Source Error:

Line 1: <%@ Page Language="VB" MasterPageFile="~/master.master"
AutoEventWireup="false" CodeFile="Default.aspx.vb"

Its trying to find the masterpage in the virtual folder not the root folder
Anyone got any thoughts on how to fix this ?

Cheers
Lee
 
G

Guest

Any thoughts guys? Got a deadline for this job and I cant get round this
one!

Hi Lee,

I think the problem here is that you did not setup application for
your virtual directory. Go to IIS, virtual dir properties and click on
Create under Application Settings. Hope this helps
 
L

lee atkinson

Hi ... Ok ive got it working kind-of ... It was actually the opposite , I
had to REMOVE the application reference from the folder as it was treating
the folder as a new application. Problem ive got now is the links on the
page don't 'see' the folder and doesn't add it to the link urls... Do I have
to add some kind of handler on the site for this?
 
G

Guest

Hi ... Ok ive got it working kind-of ... It was actually the opposite , I
had to REMOVE the application reference from the folder as it was treating
the folder as a new application. Problem ive got now is the links on the
page don't 'see' the folder and doesn't add it to the link urls... Do I have
to add some kind of handler on the site for this?

When you do this

MasterPageFile="~/master.master"

you tell that master is located in the web application root ("~" means
app root). And this will not work if app does not exist.

Creating a new application will help, but in this case you would have
a "copy" of your application and all this just because of URL. URL
Rewriting in ASP.NET can be done without using virtual directories.
Google for "URL Rewriting ASP.NET". You will find a lot of examples on
how to do this.

Regarding broken links.

Do you have

/root/sections/subsectionfiles/page.aspx
/root/section/section1/page.aspx

?
 
J

Juan T. Llibre

What I don't understand is why you are deliberately making your
application's directory structure more complex than what you seem to need.

re:
!> /root/section/section1/
!> /root/section/section2/
!> /root/section/section3/

Can't you do away with the extra "section" directory ?
Then, unless you have content in the "section" directory, it would eliminate a layer.

/root/section1/
/root/section2/
/root/section3/

re:
!> these folders map to 'subsectionfiles' folder in IIS

There's no need to map anything.
The /root/sectionx/ subfolders should be available without mapping anything.




Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
=========================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top