473,387 Members | 1,379 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

ASP VIRTUAL keyword not working in ASP.NET anymore :S

In classic ASP I could write:

<!-- #INCLUDE VIRTUAL="Kevin\General\ServiceClass.asp" -->

and it would "include" that ASP file into the current ASP file. My web
application folder was not stored in C:\Inetpub\wwwroot\ but somewhere else.
But the VIRTUAL command let IIS locate files by the IIS virtual folder.

Now in ASP.NET this does not work. It complains saying:

Could not find a part of the path
'c:\inetpub\wwwroot\Kevin\General\ServiceClass.asp x'

Is it possible creating a link/shortcut folder in \wwwroot\ ? Or how can I
get around this the easy way? I don't want to rename all VIRTUAL into FILE
and giving absolute paths.
Mar 22 '06 #1
3 1493
ASP.net is a totally different thing to classic ASP, almost nothing works in
the same way and it is not really backwards compatable at all. The
functionality you want to acheive works in a totally different way. I sugest
you forget about everything you learned in ASP and aproach ASP.net as if you
were learning a new language from scratch.

"Dhruba Bandopadhyay" wrote:
In classic ASP I could write:

<!-- #INCLUDE VIRTUAL="Kevin\General\ServiceClass.asp" -->

and it would "include" that ASP file into the current ASP file. My web
application folder was not stored in C:\Inetpub\wwwroot\ but somewhere else.
But the VIRTUAL command let IIS locate files by the IIS virtual folder.

Now in ASP.NET this does not work. It complains saying:

Could not find a part of the path
'c:\inetpub\wwwroot\Kevin\General\ServiceClass.asp x'

Is it possible creating a link/shortcut folder in \wwwroot\ ? Or how can I
get around this the easy way? I don't want to rename all VIRTUAL into FILE
and giving absolute paths.

Mar 22 '06 #2
re:
<!-- #INCLUDE VIRTUAL="Kevin\General\ServiceClass.asp" -->
Shouldn't that be :
<!-- #INCLUDE VIRTUAL="/Kevin/General/ServiceClass.asp" -->

?

VIRTUAL means, "virtual", clearly, and does not include physical paths.

re: Could not find a part of the path 'c:\inetpub\wwwroot\Kevin\General\ServiceClass.asp x'
That makes sense.

IIS adds c:\inetpub\wwwroot because it knows that it's the root application,
and tries to locate the virtual path you specified.

The general way of including files based on physical paths is "include file" :

<!--#include file="ServiceClass.asp"-->

In general, though, in ASP.NET you shouldn't be using #INCLUDE to use code in other pages.
You should use user controls ( ascx ) or class files ( *.vb or *.cs ), or assemblies.


Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Dhruba Bandopadhyay" <dh*****************@hotmail.com> wrote in message
news:uz**************@TK2MSFTNGP11.phx.gbl... In classic ASP I could write:

<!-- #INCLUDE VIRTUAL="Kevin\General\ServiceClass.asp" -->

and it would "include" that ASP file into the current ASP file. My web application folder was not
stored in C:\Inetpub\wwwroot\ but somewhere else. But the VIRTUAL command let IIS locate files by
the IIS virtual folder.

Now in ASP.NET this does not work. It complains saying:

Could not find a part of the path 'c:\inetpub\wwwroot\Kevin\General\ServiceClass.asp x'

Is it possible creating a link/shortcut folder in \wwwroot\ ? Or how can I get around this the
easy way? I don't want to rename all VIRTUAL into FILE and giving absolute paths.

Mar 22 '06 #3
Yep you are right!

It was meant to be VIRTUAL="/Kevin/.....

Somehow in ASP it probably did a fail-safe when it saw VIRTUAL="Kevin/...
and tries http://localhost/Kevin.... address. But in ASP.NET is more
stricter and requires the VIRTUAL="/Kevin/.... where the first forward slash
/ signifies the root of the website space in http://localhost/

I just need to do a massive search & replace in my old ASP app and hope that
still works there too!
"Juan T. Llibre" <no***********@nowhere.com> wrote in message
news:eJ**************@tk2msftngp13.phx.gbl...
re:
<!-- #INCLUDE VIRTUAL="Kevin\General\ServiceClass.asp" -->


Shouldn't that be :
<!-- #INCLUDE VIRTUAL="/Kevin/General/ServiceClass.asp" -->

?

VIRTUAL means, "virtual", clearly, and does not include physical paths.

re:
Could not find a part of the path
'c:\inetpub\wwwroot\Kevin\General\ServiceClass.asp x'


That makes sense.

IIS adds c:\inetpub\wwwroot because it knows that it's the root
application,
and tries to locate the virtual path you specified.

The general way of including files based on physical paths is "include
file" :

<!--#include file="ServiceClass.asp"-->

In general, though, in ASP.NET you shouldn't be using #INCLUDE to use code
in other pages.
You should use user controls ( ascx ) or class files ( *.vb or *.cs ), or
assemblies.


Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Dhruba Bandopadhyay" <dh*****************@hotmail.com> wrote in message
news:uz**************@TK2MSFTNGP11.phx.gbl...
In classic ASP I could write:

<!-- #INCLUDE VIRTUAL="Kevin\General\ServiceClass.asp" -->

and it would "include" that ASP file into the current ASP file. My web
application folder was not stored in C:\Inetpub\wwwroot\ but somewhere
else. But the VIRTUAL command let IIS locate files by the IIS virtual
folder.

Now in ASP.NET this does not work. It complains saying:

Could not find a part of the path
'c:\inetpub\wwwroot\Kevin\General\ServiceClass.asp x'

Is it possible creating a link/shortcut folder in \wwwroot\ ? Or how can
I get around this the easy way? I don't want to rename all VIRTUAL into
FILE and giving absolute paths.


Mar 22 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

20
by: Raymond Lewallen | last post by:
I read this on this website page http://www.vbip.com/books/1861004915/chapter_4915_06.asp: Unlike many object-oriented languages, all methods in VB.NET are virtual. Now in BOL, Under...
4
by: JKop | last post by:
I'm starting to think that whenever you derive one class from another, that you should use virtual inheritance *all* the time, unless you have an explicit reason not to. I'm even thinking that...
26
by: Prawit Chaivong | last post by:
Hi All, There is code here. ------------------------------------------------------------------ class Base{ public: Base(){} virtual ~Base(){} private: int a;
12
by: Daniel Kay | last post by:
Hi Folks! Everytime I work with virtual and pure virtual methods I ask myself if there is a difference between class B and class C (see below). Is it redundant to repeat the virtual keyword in a...
3
by: news.microsoft.com | last post by:
Hi, It is possible to override a non virtual method with the "new" keyword So how is this different from specifying a method as virtual then providing the override keyword? Is there any...
20
by: Nemanja Trifunovic | last post by:
Something I don't get it: Say we have: ref class Base { virtual void SomeVirtualFunction() {Console::WriteLine(L"Base");} public: void SomeAccessibleFunction() {SomeVirtualFunction();}
15
by: Philipp | last post by:
Hello I don't exactly understand why there are no static virtual functions. I would have liked something like this: class Base{ static virtual std::string getName(){ return "Base"; } }
4
by: David Zha0 | last post by:
Hi, "when we call a virtual method, the runtime will check the instance who called the method and then choose the suitable override method, this may causes the performance drop down", is this...
0
by: George2 | last post by:
Hello everyone, I am using perfmon to watch the working set and virtual bytes, when I do a keyword search in SourceInsight. I found the value of working set is larger than virtual bytes when...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.