Click here to Skip to main content
15,884,388 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
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

ASP
<!--#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

1 solution

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.
: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[^]
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900