473,796 Members | 2,607 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with include files!

Hello,

I am new to ASP and am trying to make some changes to some ASP 3.0 code
I have inherited.

I have a number of ASP pages with VBS as the base language, on each of
these pages I have successfully included a piece of VBS code that
produces output in a table cell by using:

<!--#include file="showAnswe rs.inc" -->

I have added a new page to the site where the base language is
JavaScript. If I try to use the same include line there it doesn't work
as it correctly detects that the code in the include file is written in
VBScript not JavaScript.

So I tried...

<Script language="VBScr ipt" src="showAnswer s.inc" </Script>

The page runs in the browser without error but the code in the include
file isn't included so I don't get the output I expect.

So i try...
<Script language="VBScr ipt" src="showAnswer s.inc" RUNAT="server"> </Script>

The include now works but the output of the included code appears at the
top of the output, not in the table cell where I want it.

I have no idea how to resolve this. Can anyone help?

Thanks
Jules
Jun 22 '06 #1
14 2343
weird. i have now run into the same problem. some of my includes work, and
some are not.
i moved the same files into a subweb, and they work there.
wondering what's up with that.

"Julesh" <ca************ **@hotmail.com> wrote in message
news:Dh******** ***********@fe3 .news.blueyonde r.co.uk...
Hello,

I am new to ASP and am trying to make some changes to some ASP 3.0 code I
have inherited.

I have a number of ASP pages with VBS as the base language, on each of
these pages I have successfully included a piece of VBS code that produces
output in a table cell by using:

<!--#include file="showAnswe rs.inc" -->

I have added a new page to the site where the base language is JavaScript.
If I try to use the same include line there it doesn't work as it
correctly detects that the code in the include file is written in VBScript
not JavaScript.

So I tried...

<Script language="VBScr ipt" src="showAnswer s.inc" </Script>

The page runs in the browser without error but the code in the include
file isn't included so I don't get the output I expect.

So i try...
<Script language="VBScr ipt" src="showAnswer s.inc" RUNAT="server"> </Script>

The include now works but the output of the included code appears at the
top of the output, not in the table cell where I want it.

I have no idea how to resolve this. Can anyone help?

Thanks
Jules

Jun 23 '06 #2
well,

mixing server side javascript and vbscript in the same code is seldom a good
idea

your learning that

best to stick to one or the other I say..

I have fooled around with mixing the two and only got very simple things to
work correctly at best


"Julesh" <ca************ **@hotmail.com> wrote in message
news:Dh******** ***********@fe3 .news.blueyonde r.co.uk...
Hello,

I am new to ASP and am trying to make some changes to some ASP 3.0 code I
have inherited.

I have a number of ASP pages with VBS as the base language, on each of
these pages I have successfully included a piece of VBS code that produces
output in a table cell by using:

<!--#include file="showAnswe rs.inc" -->

I have added a new page to the site where the base language is JavaScript.
If I try to use the same include line there it doesn't work as it
correctly detects that the code in the include file is written in VBScript
not JavaScript.

So I tried...

<Script language="VBScr ipt" src="showAnswer s.inc" </Script>

The page runs in the browser without error but the code in the include
file isn't included so I don't get the output I expect.

So i try...
<Script language="VBScr ipt" src="showAnswer s.inc" RUNAT="server"> </Script>

The include now works but the output of the included code appears at the
top of the output, not in the table cell where I want it.

I have no idea how to resolve this. Can anyone help?

Thanks
Jules

Jun 23 '06 #3

"Julesh" <ca************ **@hotmail.com> wrote in message
news:Dh******** ***********@fe3 .news.blueyonde r.co.uk...
Hello,

I am new to ASP and am trying to make some changes to some ASP 3.0 code
I have inherited.

I have a number of ASP pages with VBS as the base language, on each of
these pages I have successfully included a piece of VBS code that
produces output in a table cell by using:

<!--#include file="showAnswe rs.inc" -->

A poor design choice on the part of the original development.
I have added a new page to the site where the base language is
JavaScript. If I try to use the same include line there it doesn't work
as it correctly detects that the code in the include file is written in
VBScript not JavaScript.

So I tried...

<Script language="VBScr ipt" src="showAnswer s.inc" </Script>

This just tries to run the contents of the include on the client. (Use of
inc extension allows the client to download the file content another poor
choice.)
The page runs in the browser without error but the code in the include
file isn't included so I don't get the output I expect.

So i try...
<Script language="VBScr ipt" src="showAnswer s.inc" RUNAT="server"> </Script>

I'm suprised this works at all. It normally isn't possible to use an ASP
include as a VBScript source, this include is likely to at least have a
couple of <% %> delimiters which are invalid in VBScript. In order to this
to work these delimiters would need to be removed but then all the other
normal uses of the include would break.

There is another problem with this approach when the specified language
isn't the same as the page language. The content will not be executed in
line but will executed before the rest of the page has been processed.
The include now works but the output of the included code appears at the
top of the output, not in the table cell where I want it.

I have no idea how to resolve this. Can anyone help?

The easiest solution is to stop using JScript as your base language.

If you really must use JScript then the only solution I can see is leave the
page as VBScript and place all your JScript in a:-

<script language="JScri pt" runat="Server">
..
..
..
</script>

block at the top of your page. Note that this should contain pure Jscript,
no inline HTML, also any code that generates output to the response should
be inside functions. You then call the functions from the pages VBScript
language at the point you need them.

Anthony.


Thanks
Jules

Jun 23 '06 #4
Kyle Peterson wrote on 23 jun 2006 in
microsoft.publi c.inetserver.as p.general:
mixing server side javascript and vbscript in the same code is seldom
a good idea


I think it is a very viable idea, I use it often.

I use vbs as the main script, and JS only to define certain functions.

Especially small regex test functions are much easier written in JS,
[once you get the hang of it!!!]:

<% 'vbscript main

.......

if NOT testPassword(pa ssw) then ...

%>

<script language='javas cript' runat='server'>
// contains at least 1 letter char and 1 number char?
function testPassword(x) {
return /\d/.test(x) && /[a-z]/i.test(x)
}
</script>
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jun 23 '06 #5
Anthony Jones wrote on 23 jun 2006 in
microsoft.publi c.inetserver.as p.general:
If you really must use JScript then the only solution I can see is
leave the page as VBScript and place all your JScript in a:-

<script language="JScri pt" runat="Server">
.
.
.
</script>

block at the top of your page.
The position in the file [not "page"] does not matter,
since in a vbs-asp file the JS-runats are executed first anyway.
Note that this should contain pure Jscript,
no inline HTML, also any code that generates output to the response
should be inside functions.


A easy advice, since _inline_ html IN a runat='..' is not possible anyway.

response.write( 'Hello world'); is possible, but it seems better to stick to
function definitions.


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jun 23 '06 #6

"Evertjan." <ex************ **@interxnl.net > wrote in message
news:Xn******** ************@19 4.109.133.242.. .
Kyle Peterson wrote on 23 jun 2006 in
microsoft.publi c.inetserver.as p.general:
mixing server side javascript and vbscript in the same code is seldom
a good idea

I think it is a very viable idea, I use it often.

I use vbs as the main script, and JS only to define certain functions.

Especially small regex test functions are much easier written in JS,
[once you get the hang of it!!!]:


That's interesting point of view. I'm not sure I'd want to ask ASP to run
JScript as well as VBScript for sake of a few lines of code. Also the
JScript implementation of RegExp gets annoying when you want to run a global
match with submatches.
<% 'vbscript main

......

if NOT testPassword(pa ssw) then ...

%>

<script language='javas cript' runat='server'>
// contains at least 1 letter char and 1 number char?
function testPassword(x) {
return /\d/.test(x) && /[a-z]/i.test(x)
}
</script>
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Jun 23 '06 #7

"Evertjan." <ex************ **@interxnl.net > wrote in message
news:Xn******** ************@19 4.109.133.242.. .
Anthony Jones wrote on 23 jun 2006 in
microsoft.publi c.inetserver.as p.general:
If you really must use JScript then the only solution I can see is
leave the page as VBScript and place all your JScript in a:-

<script language="JScri pt" runat="Server">
.
.
.
</script>

block at the top of your page.
The position in the file [not "page"]


Has anyone ever pointed out to you how painfully pedantic you are
does not matter,
since in a vbs-asp file the JS-runats are executed first anyway.

True but since it does get executed first you may as well put it first just
to be clear.
Note that this should contain pure Jscript,
no inline HTML, also any code that generates output to the response
should be inside functions.


A easy advice, since _inline_ html IN a runat='..' is not possible anyway.


Which is why I said don't do it.

response.write( 'Hello world'); is possible, but it seems better to stick to function definitions.


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Jun 23 '06 #8
Anthony Jones wrote on 23 jun 2006 in
microsoft.publi c.inetserver.as p.general:
> If you really must use JScript then the only solution I can see is
> leave the page as VBScript and place all your JScript in a:-
>
> <script language="JScri pt" runat="Server">
> </script>
>
> block at the top of your page.
The position in the file [not "page"]
Has anyone ever pointed out to you how painfully pedantic you are


Why do you snear when you are corrected? Bad day, Anthony?

Many mistakes are a result of the misconseption, that ASP-"pages" exist.
does not matter,
since in a vbs-asp file the JS-runats are executed first anyway.

True but since it does get executed first you may as well put it first
just to be clear.


As well? I don't think so, I like to have my simple function definitions
at the bottom out of the way, as I treat them as reusable black boxes.

It is a personal preference, which I would advocate as useful.
> Note that this should contain pure Jscript,
> no inline HTML, also any code that generates output to the response
> should be inside functions.


A easy advice, since _inline_ html IN a runat='..' is not possible
anyway.


Which is why I said don't do it.


Isn't advising not to do what is impossible to do anyway a bit strange?

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jun 23 '06 #9

"Evertjan." <ex************ **@interxnl.net > wrote in message
news:Xn******** ************@19 4.109.133.242.. .
Anthony Jones wrote on 23 jun 2006 in
microsoft.publi c.inetserver.as p.general:
> If you really must use JScript then the only solution I can see is
> leave the page as VBScript and place all your JScript in a:-
>
> <script language="JScri pt" runat="Server">
> </script>
>
> block at the top of your page. The position in the file [not "page"]
Has anyone ever pointed out to you how painfully pedantic you are


Why do you snear when you are corrected? Bad day, Anthony?


Yeah I kinda snapped seeing yet another 'correction' from of something which
really doesn't need correcting.
Many mistakes are a result of the misconseption, that ASP-"pages" exist.
Such as?
does not matter,
since in a vbs-asp file the JS-runats are executed first anyway.
True but since it does get executed first you may as well put it first
just to be clear.
As well? I don't think so, I like to have my simple function definitions
at the bottom out of the way, as I treat them as reusable black boxes.

It is a personal preference, which I would advocate as useful.


Fair enough.
> Note that this should contain pure Jscript,
> no inline HTML, also any code that generates output to the response
> should be inside functions.

A easy advice, since _inline_ html IN a runat='..' is not possible
anyway.


Which is why I said don't do it.


Isn't advising not to do what is impossible to do anyway a bit strange?


Not when the original poster is clearly not sure what is and isn't
impossible.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Jun 23 '06 #10

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

Similar topics

9
2647
by: Bartosz Wegrzyn | last post by:
I need help with sessions. I createt set of web site for nav with authorization. first I go into main.php which looks like this: <?php //common functions include_once '../login/common.php'; global $LOGINDIR;
7
10629
by: Forecast | last post by:
I run the following code in UNIX compiled by g++ 3.3.2 successfully. : // proj2.cc: returns a dynamic vector and prints out at main~~ : // : #include <iostream> : #include <vector> : : using namespace std; : : vector<string>* getTyphoon()
15
2433
by: Ken Allen | last post by:
I have been developing a suite of assemblies over the past couple of weeks, and this afternoon somethign started misbehaving. If I do not run the IDE and compiler the code from the command line, the compilation seems to work properly almost all of the time. More on this later. If I launch one copy of the IDE, then I can usually compile the project at least once. At some point, the build fails reporting "Could not copy temporary files...
13
9679
by: kamaraj80 | last post by:
Hi I am using the std:: map as following. typedef struct _SeatRowCols { long nSeatRow; unsigned char ucSeatLetter; }SeatRowCols; typedef struct _NetData
9
4044
by: chat | last post by:
Hi, every body. I have 3 files like this: -------------------------------------------------------- file name : header.h #ifndef TEST_H #define TEST_H int a=1; double b=0.5;
9
13280
by: Prasad | last post by:
HI, I am a beginner in VC++.. I am trying to write a Win32 console application in visual studio.. I am using following header files.. #include <STRING> using namespace std; #include <hash_map>//from Standard template library //and some other headers
1
5447
by: Arsalan Ahmad | last post by:
Hi all, I am trying to compile some source files using makefile. While compiling I am getting errors as shown below. Any idea how can I solve this problem. I believe I need to add some preprocessor directives but I dont know which one. Thanks, Arsalan
8
1734
by: supasnail | last post by:
I have a happily working set of asp pages which read from the database via include file "./_private/include/database.mdb". However, when I try to gain access to this database on pages one folder removed using "../_private/include/database.mdb", the pages won't display. This whole system works fine on my home test server (iis.5.0), but 'breaks' when uploaded to the public server. I know the path to database is correct because the upper...
0
2120
by: james.mcdonagh | last post by:
Hi I am a newbie using nAnt for .net 2.0. As such I have not come across this bug before, and I would be happy of any help that you may be able to provide. In order to help I have included the nant file which is causing the problem, the object code that is not being built and the error message which is being produced. The weird thing is that VS.net builds without a problem. And the intellisense within the object WorkQueue knows that...
2
6664
myusernotyours
by: myusernotyours | last post by:
Hi All, Am working on a Java application in which I have to use the JNI to Interface with some native code for both windows and unix. Am using netbeans IDE with the C/C++ pack installed. Am also using Cygwin as my compiler (gcc), this is ostensibly because I hope this compiler will also compile the unix native libraries since I don't have a Linux installation. (I am working on a personal project from the office and can't get linux installed)....
0
9685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9531
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9055
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7553
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6795
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5446
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4120
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3735
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2928
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.