Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: IIS7 ASP ASP.NET VBScript IIS , +
I have a client who has a main website (it's huge) rooted at (on my dev box)
 
C:\inetpub\wwwroot\Website.com\trunk
 
It's controlled with Subversion (SVN) (sucks to be the client by the way because I think SVN is terrible, but that's just my "religious" opinion). Anyway, their whole website is done up in Classic ASP and VBScript.
 
They have this new set of pages they want me to write under the directory
 
C:\inetpub\wwwroot\Website.com\trunk\mydir\purchase\
 
And they want it done up in ASP.NET and VB.NET and the usual N-Tier architecture for hitting the DB (which is SQL Server 2005 by the way). I am using VS2010.
 
So I did the usual rigamarole of adding a Class Library project for the data layer and business layer yada yada. No problem there. Now I am adding the front-end. I went into VS-2010 and said "New Web Site" and created an ASP.NET Empty Web Site in
 
C:\inetpub\wwwroot\Website.com\trunk\mydir\purchase\
 
OK. By the way, there's IIS7 on the dev box and it works fine, to the point that typing
 
http://localhost/index.asp
 
Serves up the page
 
C:\inetpub\wwwroot\Website.com\trunk\index.asp
 
just fine.
 
OK, so I am building my ASP.NET page and I want to put a Server-Side-Include for my header of the page. Can't use master pages and can't use Server.MapPath because the ASP.NET web development server is brainless and does not map the paths correctly. The include says
 
<!--#include file="../../includes/header.asp" -->
 
When I open up my browser to
 
http://localhost/mydir/purchase/index.aspx
 
The page loads just fine, but in VS2010 when I do a Build, I get the "Failed to map path '/includes/header.asp'" error....but I am working just fine in the browser with the above URL because I am on an over-arching IIS7 super-website!
 
Gawd, VS2010 is retarded...
 
The ASP.NET Web Development Server and VS2010 think the website root (/) is at
 
C:\inetpub\wwwroot\Website.com\trunk\mydir\purchase\
 
but of course it is not that, in "reality". But this stupid error is keeping me from debugging. So I get why the error is popping up. Any way to keep the "include" statement there and suppress the error, so I can debug using VS2010?
 
I am going to kill the first person to tell me to use Response.Write or Server.MapPath or the tilde ~ because those functions are brainless, first because they don't allow you to use ".." and secondly because they are getting the website root wrong.
 
So....any thoughts??? Thanks!
 
Brian
Posted 10-Aug-11 5:32am

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Brian C Hart wrote:
I am going to kill the first person to tell me to use Response.Write or Server.MapPath or the tilde ~ because those functions are brainless, first because they don't allow you to use ".." and secondly because they are getting the website root wrong.
Big Grin | :-D Please don't.
Better create user controls from those includes like Header.ascx, Footer.ascx & so on. Otherwise you only have to follow the old things.
Failed to map the path error when including virtual ASP pages within ASP.NET[^]
How To Dynamically Include Files in ASP.NET[^]
Server-Side Include Directive Syntax[^]
 
A nice article for you
Migrating from ASP to ASP.NET[^]
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 400
1 Jochen Arndt 190
2 Richard MacCutchan 135
3 DamithSL 95
4 Garth J Lancaster 90
0 OriginalGriff 6,045
1 DamithSL 4,601
2 Maciej Los 4,032
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,220


Advertise | Privacy | Mobile
Web02 | 2.8.141220.1 | Last Updated 10 Dec 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100