473,383 Members | 1,735 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,383 software developers and data experts.

Includes not allowed in Server Script tags

I am not sure why I am getting this error:

I have the following code I want to run from another include file that holds
all my functions.

functions.inc
************************************************** **********************************
<Script runat="Server">
Sub fnHeader(client As String)
response.write("<!-- #include file = ../includes/staffingHeaders.inc -->")
end function

function fnFooter(client As String)
response.write("<!-- #include file = ../includes/staffingFooters.inc -->")
end function
</script>
************************************************** **********************************

My pages would look something like:

************************************************** ***************************
<!-- #include file = ../includes/functions.inc -->
<%@ Page Language="VB" AutoEventWireup="true" ContentType="text/html"
ResponseEncoding="iso-8859-1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
....

<%
Call fnHeader("Richard")
%>

.... Code specific to this page

<%
Call fnFooter("Richard")
%>

....
</html>
************************************************** ****************************

The calls would put an include file at that point which has some generic
HTML code or ASP.NET code in it.

The problem is I get the following 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: Server includes are not allowed in server script tags.

Source Error:

Line 1: <Script runat="Server">
Line 2: Sub fnHeader(client As String)
Line 3: response.write("<!-- #include file =
.../includes/staffingHeaders.inc -->")
Line 4: end function
Line 5:
Source File: c:\inetpub\wwwroot\development\includes\functions. inc Line:
3
************************************************** ****************

Why do I get this and is there a way to do what I want to do?

Thanks,

Tom.
Nov 18 '05 #1
12 2955
Hi Tom:

In the long run, you'll do best to move from using include files to
using User Controls and/or Server Controls. User controls are easy to
create and consume.

http://msdn.microsoft.com/library/de...ercontrols.asp

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Fri, 19 Nov 2004 12:57:33 -0800, "tshad"
<ts**********@ftsolutions.com> wrote:
I am not sure why I am getting this error:

I have the following code I want to run from another include file that holds
all my functions.

functions.inc
************************************************* ***********************************
<Script runat="Server">
Sub fnHeader(client As String)
response.write("<!-- #include file = ../includes/staffingHeaders.inc -->")
end function

function fnFooter(client As String)
response.write("<!-- #include file = ../includes/staffingFooters.inc -->")
end function
</script>
************************************************* ***********************************

My pages would look something like:

************************************************* ****************************
<!-- #include file = ../includes/functions.inc -->
<%@ Page Language="VB" AutoEventWireup="true" ContentType="text/html"
ResponseEncoding="iso-8859-1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
...

<%
Call fnHeader("Richard")
%>

... Code specific to this page

<%
Call fnFooter("Richard")
%>

...
</html>
************************************************* *****************************

The calls would put an include file at that point which has some generic
HTML code or ASP.NET code in it.

The problem is I get the following 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: Server includes are not allowed in server script tags.

Source Error:

Line 1: <Script runat="Server">
Line 2: Sub fnHeader(client As String)
Line 3: response.write("<!-- #include file =
../includes/staffingHeaders.inc -->")
Line 4: end function
Line 5:
Source File: c:\inetpub\wwwroot\development\includes\functions. inc Line:
3
************************************************* *****************

Why do I get this and is there a way to do what I want to do?

Thanks,

Tom.


Nov 18 '05 #2
You pass a parameter to fnHeader (client as string) but then subsequently
ignore it?

Since there appears to be no branching logic based on parameters, why not
simply Include the file per usual?

Jeff
"tshad" <ts**********@ftsolutions.com> wrote in message
news:eq**************@TK2MSFTNGP09.phx.gbl...
I am not sure why I am getting this error:

I have the following code I want to run from another include file that holds all my functions.

functions.inc
************************************************** **************************
******** <Script runat="Server">
Sub fnHeader(client As String)
response.write("<!-- #include file = .../includes/staffingHeaders.inc -->") end function

function fnFooter(client As String)
response.write("<!-- #include file = .../includes/staffingFooters.inc -->") end function
</script>
************************************************** **************************
********
My pages would look something like:

************************************************** **************************
* <!-- #include file = ../includes/functions.inc -->
<%@ Page Language="VB" AutoEventWireup="true" ContentType="text/html"
ResponseEncoding="iso-8859-1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
...

<%
Call fnHeader("Richard")
%>

... Code specific to this page

<%
Call fnFooter("Richard")
%>

...
</html>
************************************************** **************************
**
The calls would put an include file at that point which has some generic
HTML code or ASP.NET code in it.

The problem is I get the following 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: Server includes are not allowed in server script tags.
Source Error:

Line 1: <Script runat="Server">
Line 2: Sub fnHeader(client As String)
Line 3: response.write("<!-- #include file =
../includes/staffingHeaders.inc -->")
Line 4: end function
Line 5:
Source File: c:\inetpub\wwwroot\development\includes\functions. inc Line: 3
************************************************** ****************

Why do I get this and is there a way to do what I want to do?

Thanks,

Tom.

Nov 18 '05 #3
"Scott Allen" <bitmask@[nospam].fred.net> wrote in message
news:e8********************************@4ax.com...
Hi Tom:

In the long run, you'll do best to move from using include files to
using User Controls and/or Server Controls. User controls are easy to
create and consume.
I tried that and they work great. But the whole reason for using my include
files was to be able to call different include files from the same routine
based on who the client is (this was why I was not using the passed
variable - I hadn't got that far yet).

Now I am having the problem with my include statement when I want to change
the file name it calls.

Here is the .ascx file:

************************************************** *******************************
<Script runat="server">
Public ClientName As String = "Staff"
</Script>

<!-- #include file = ..\includes\<%=ClientName%>Headers.inc -->
************************************************** *******************************

This gives me an error:

************************************************** *******************************
Parser Error Message: Illegal characters in path.

Source Error:

Line 3: </Script>
Line 4:
Line 5: <!-- #include file = ..\includes\<%=ClientName%>Headers.inc -->
************************************************** *******************************

How can I get this statement to work with variable file names
(staffheaders.inc, employeeheaders.inc, etc.).

Thanks,

Tom.
http://msdn.microsoft.com/library/de...ercontrols.asp

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Fri, 19 Nov 2004 12:57:33 -0800, "tshad"
<ts**********@ftsolutions.com> wrote:
I am not sure why I am getting this error:

I have the following code I want to run from another include file that
holds
all my functions.

functions.inc
************************************************ ************************************
<Script runat="Server">
Sub fnHeader(client As String)
response.write("<!-- #include file =
../includes/staffingHeaders.inc -->")
end function

function fnFooter(client As String)
response.write("<!-- #include file =
../includes/staffingFooters.inc -->")
end function
</script>
************************************************ ************************************

My pages would look something like:

************************************************ *****************************
<!-- #include file = ../includes/functions.inc -->
<%@ Page Language="VB" AutoEventWireup="true" ContentType="text/html"
ResponseEncoding="iso-8859-1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
...

<%
Call fnHeader("Richard")
%>

... Code specific to this page

<%
Call fnFooter("Richard")
%>

...
</html>
************************************************ ******************************

The calls would put an include file at that point which has some generic
HTML code or ASP.NET code in it.

The problem is I get the following 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: Server includes are not allowed in server script
tags.

Source Error:

Line 1: <Script runat="Server">
Line 2: Sub fnHeader(client As String)
Line 3: response.write("<!-- #include file =
../includes/staffingHeaders.inc -->")
Line 4: end function
Line 5:
Source File: c:\inetpub\wwwroot\development\includes\functions. inc
Line:
3
************************************************ ******************

Why do I get this and is there a way to do what I want to do?

Thanks,

Tom.

Nov 18 '05 #4
"Jeff Dillon" <je**@removeemergencyreporting.com> wrote in message
news:ec**************@TK2MSFTNGP11.phx.gbl...
You pass a parameter to fnHeader (client as string) but then subsequently
ignore it?

As I mentioned in my other post - I hadn't got to using the parameter yet,
as I couldn't get past the error I was getting.

Tom. Since there appears to be no branching logic based on parameters, why not
simply Include the file per usual?

Jeff
"tshad" <ts**********@ftsolutions.com> wrote in message
news:eq**************@TK2MSFTNGP09.phx.gbl...
I am not sure why I am getting this error:

I have the following code I want to run from another include file that

holds
all my functions.

functions.inc

************************************************** **************************
********
<Script runat="Server">
Sub fnHeader(client As String)
response.write("<!-- #include file =

../includes/staffingHeaders.inc -->")
end function

function fnFooter(client As String)
response.write("<!-- #include file =

../includes/staffingFooters.inc -->")
end function
</script>

************************************************** **************************
********

My pages would look something like:

************************************************** **************************
*
<!-- #include file = ../includes/functions.inc -->
<%@ Page Language="VB" AutoEventWireup="true" ContentType="text/html"
ResponseEncoding="iso-8859-1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
...

<%
Call fnHeader("Richard")
%>

... Code specific to this page

<%
Call fnFooter("Richard")
%>

...
</html>

************************************************** **************************
**

The calls would put an include file at that point which has some generic
HTML code or ASP.NET code in it.

The problem is I get the following 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: Server includes are not allowed in server script

tags.

Source Error:

Line 1: <Script runat="Server">
Line 2: Sub fnHeader(client As String)
Line 3: response.write("<!-- #include file =
../includes/staffingHeaders.inc -->")
Line 4: end function
Line 5:
Source File: c:\inetpub\wwwroot\development\includes\functions. inc

Line:
3
************************************************** ****************

Why do I get this and is there a way to do what I want to do?

Thanks,

Tom.


Nov 18 '05 #5
You are really very likely to have beaucoups problems if you continue to use
an object-oriented technology in a procedural way. Kind of like trying to
drive a car with an automatic transmission by shifting the gears.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Neither a follower
nor a lender be.

"tshad" <ts**********@ftsolutions.com> wrote in message
news:Op**************@tk2msftngp13.phx.gbl...
"Scott Allen" <bitmask@[nospam].fred.net> wrote in message
news:e8********************************@4ax.com...
Hi Tom:

In the long run, you'll do best to move from using include files to
using User Controls and/or Server Controls. User controls are easy to
create and consume.
I tried that and they work great. But the whole reason for using my

include files was to be able to call different include files from the same routine
based on who the client is (this was why I was not using the passed
variable - I hadn't got that far yet).

Now I am having the problem with my include statement when I want to change the file name it calls.

Here is the .ascx file:

************************************************** **************************
***** <Script runat="server">
Public ClientName As String = "Staff"
</Script>

<!-- #include file = ..\includes\<%=ClientName%>Headers.inc -->
************************************************** **************************
*****
This gives me an error:

************************************************** **************************
***** Parser Error Message: Illegal characters in path.

Source Error:

Line 3: </Script>
Line 4:
Line 5: <!-- #include file = ..\includes\<%=ClientName%>Headers.inc -->
************************************************** **************************
*****
How can I get this statement to work with variable file names
(staffheaders.inc, employeeheaders.inc, etc.).

Thanks,

Tom.

http://msdn.microsoft.com/library/de...ercontrols.asp

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Fri, 19 Nov 2004 12:57:33 -0800, "tshad"
<ts**********@ftsolutions.com> wrote:
I am not sure why I am getting this error:

I have the following code I want to run from another include file that
holds
all my functions.

functions.inc

************************************************ **************************

**********
<Script runat="Server">
Sub fnHeader(client As String)
response.write("<!-- #include file =
../includes/staffingHeaders.inc -->")
end function

function fnFooter(client As String)
response.write("<!-- #include file =
../includes/staffingFooters.inc -->")
end function
</script>
************************************************ **************************

**********

My pages would look something like:
************************************************ **************************

***
<!-- #include file = ../includes/functions.inc -->
<%@ Page Language="VB" AutoEventWireup="true" ContentType="text/html"
ResponseEncoding="iso-8859-1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
...

<%
Call fnHeader("Richard")
%>

... Code specific to this page

<%
Call fnFooter("Richard")
%>

...
</html>
************************************************ **************************

****

The calls would put an include file at that point which has some generic
HTML code or ASP.NET code in it.

The problem is I get the following 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: Server includes are not allowed in server script
tags.

Source Error:

Line 1: <Script runat="Server">
Line 2: Sub fnHeader(client As String)
Line 3: response.write("<!-- #include file =
../includes/staffingHeaders.inc -->")
Line 4: end function
Line 5:
Source File: c:\inetpub\wwwroot\development\includes\functions. inc
Line:
3
************************************************ ******************

Why do I get this and is there a way to do what I want to do?

Thanks,

Tom.


Nov 18 '05 #6
"Kevin Spencer" <ks******@takempis.com> wrote in message
news:ex**************@TK2MSFTNGP09.phx.gbl...
You are really very likely to have beaucoups problems if you continue to
use
an object-oriented technology in a procedural way. Kind of like trying to
drive a car with an automatic transmission by shifting the gears.
But then how am I going to be able to call different "includes" based on
some criteria (passed, read from a file etc) - or can I?

This seems like I pretty simple thing to do (but the simple things usually
tend to be the most difficult).

Tom

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Neither a follower
nor a lender be.

"tshad" <ts**********@ftsolutions.com> wrote in message
news:Op**************@tk2msftngp13.phx.gbl...
"Scott Allen" <bitmask@[nospam].fred.net> wrote in message
news:e8********************************@4ax.com...
> Hi Tom:
>
> In the long run, you'll do best to move from using include files to
> using User Controls and/or Server Controls. User controls are easy to
> create and consume.


I tried that and they work great. But the whole reason for using my

include
files was to be able to call different include files from the same
routine
based on who the client is (this was why I was not using the passed
variable - I hadn't got that far yet).

Now I am having the problem with my include statement when I want to

change
the file name it calls.

Here is the .ascx file:

************************************************** **************************
*****
<Script runat="server">
Public ClientName As String = "Staff"
</Script>

<!-- #include file = ..\includes\<%=ClientName%>Headers.inc -->

************************************************** **************************
*****

This gives me an error:

************************************************** **************************
*****
Parser Error Message: Illegal characters in path.

Source Error:

Line 3: </Script>
Line 4:
Line 5: <!-- #include file = ..\includes\<%=ClientName%>Headers.inc -->

************************************************** **************************
*****

How can I get this statement to work with variable file names
(staffheaders.inc, employeeheaders.inc, etc.).

Thanks,

Tom.
>
> http://msdn.microsoft.com/library/de...ercontrols.asp >
> --
> Scott
> http://www.OdeToCode.com/blogs/scott/
>
> On Fri, 19 Nov 2004 12:57:33 -0800, "tshad"
> <ts**********@ftsolutions.com> wrote:
>
>>I am not sure why I am getting this error:
>>
>>I have the following code I want to run from another include file that
>>holds
>>all my functions.
>>
>>functions.inc

*********************************************** *************************** ********** >><Script runat="Server">
>>Sub fnHeader(client As String)
>> response.write("<!-- #include file =
>> ../includes/staffingHeaders.inc -->")
>>end function
>>
>>function fnFooter(client As String)
>> response.write("<!-- #include file =
>> ../includes/staffingFooters.inc -->")
>>end function
>></script>

*********************************************** *************************** ********** >>
>>My pages would look something like:
>>

*********************************************** *************************** *** >><!-- #include file = ../includes/functions.inc -->
>><%@ Page Language="VB" AutoEventWireup="true" ContentType="text/html"
>>ResponseEncoding="iso-8859-1" %>
>><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
>><html>
>>...
>>
>><%
>> Call fnHeader("Richard")
>>%>
>>
>>... Code specific to this page
>>
>><%
>> Call fnFooter("Richard")
>>%>
>>
>>...
>></html>

*********************************************** *************************** **** >>
>>The calls would put an include file at that point which has some
>>generic
>>HTML code or ASP.NET code in it.
>>
>>The problem is I get the following 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: Server includes are not allowed in server script
>>tags.
>>
>>Source Error:
>>
>>Line 1: <Script runat="Server">
>>Line 2: Sub fnHeader(client As String)
>>Line 3: response.write("<!-- #include file =
>>../includes/staffingHeaders.inc -->")
>>Line 4: end function
>>Line 5:
>>
>>
>>Source File: c:\inetpub\wwwroot\development\includes\functions. inc
>>Line:
>>3
>>************************************************ ******************
>>
>>Why do I get this and is there a way to do what I want to do?
>>
>>Thanks,
>>
>>Tom.
>>
>



Nov 18 '05 #7
> But then how am I going to be able to call different "includes" based on
some criteria (passed, read from a file etc) - or can I?


You can achieve that by using OO programming techniques such as inheritance.
If you need to instantiate an object dynamically based on a string read from
a file or say database, you can do that using .NET feature such as
Reflections. As others have mentioned, stop thinking procedural 'classic' asp
way and start thinking OOP way.
Nov 18 '05 #8
It could happen by setting different properties on the control, or
binding a different set of data to the control, or even dynamically
creating and adding a different control altogether.

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Fri, 19 Nov 2004 14:45:59 -0800, "tshad"
<ts**********@ftsolutions.com> wrote:
"Kevin Spencer" <ks******@takempis.com> wrote in message
news:ex**************@TK2MSFTNGP09.phx.gbl...
You are really very likely to have beaucoups problems if you continue to
use
an object-oriented technology in a procedural way. Kind of like trying to
drive a car with an automatic transmission by shifting the gears.


But then how am I going to be able to call different "includes" based on
some criteria (passed, read from a file etc) - or can I?

This seems like I pretty simple thing to do (but the simple things usually
tend to be the most difficult).

Tom

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Neither a follower
nor a lender be.

"tshad" <ts**********@ftsolutions.com> wrote in message
news:Op**************@tk2msftngp13.phx.gbl...
"Scott Allen" <bitmask@[nospam].fred.net> wrote in message
news:e8********************************@4ax.com...
> Hi Tom:
>
> In the long run, you'll do best to move from using include files to
> using User Controls and/or Server Controls. User controls are easy to
> create and consume.

I tried that and they work great. But the whole reason for using my

include
files was to be able to call different include files from the same
routine
based on who the client is (this was why I was not using the passed
variable - I hadn't got that far yet).

Now I am having the problem with my include statement when I want to

change
the file name it calls.

Here is the .ascx file:

************************************************** **************************
*****
<Script runat="server">
Public ClientName As String = "Staff"
</Script>

<!-- #include file = ..\includes\<%=ClientName%>Headers.inc -->

************************************************** **************************
*****

This gives me an error:

************************************************** **************************
*****
Parser Error Message: Illegal characters in path.

Source Error:

Line 3: </Script>
Line 4:
Line 5: <!-- #include file = ..\includes\<%=ClientName%>Headers.inc -->

************************************************** **************************
*****

How can I get this statement to work with variable file names
(staffheaders.inc, employeeheaders.inc, etc.).

Thanks,

Tom.
>
>

http://msdn.microsoft.com/library/de...ercontrols.asp
>
> --
> Scott
> http://www.OdeToCode.com/blogs/scott/
>
> On Fri, 19 Nov 2004 12:57:33 -0800, "tshad"
> <ts**********@ftsolutions.com> wrote:
>
>>I am not sure why I am getting this error:
>>
>>I have the following code I want to run from another include file that
>>holds
>>all my functions.
>>
>>functions.inc

********************************************** ****************************

**********
>><Script runat="Server">
>>Sub fnHeader(client As String)
>> response.write("<!-- #include file =
>> ../includes/staffingHeaders.inc -->")
>>end function
>>
>>function fnFooter(client As String)
>> response.write("<!-- #include file =
>> ../includes/staffingFooters.inc -->")
>>end function
>></script>

********************************************** ****************************

**********
>>
>>My pages would look something like:
>>

********************************************** ****************************

***
>><!-- #include file = ../includes/functions.inc -->
>><%@ Page Language="VB" AutoEventWireup="true" ContentType="text/html"
>>ResponseEncoding="iso-8859-1" %>
>><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
>><html>
>>...
>>
>><%
>> Call fnHeader("Richard")
>>%>
>>
>>... Code specific to this page
>>
>><%
>> Call fnFooter("Richard")
>>%>
>>
>>...
>></html>

********************************************** ****************************

****
>>
>>The calls would put an include file at that point which has some
>>generic
>>HTML code or ASP.NET code in it.
>>
>>The problem is I get the following 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: Server includes are not allowed in server script
>>tags.
>>
>>Source Error:
>>
>>Line 1: <Script runat="Server">
>>Line 2: Sub fnHeader(client As String)
>>Line 3: response.write("<!-- #include file =
>>../includes/staffingHeaders.inc -->")
>>Line 4: end function
>>Line 5:
>>
>>
>>Source File: c:\inetpub\wwwroot\development\includes\functions. inc
>>Line:
>>3
>>************************************************ ******************
>>
>>Why do I get this and is there a way to do what I want to do?
>>
>>Thanks,
>>
>>Tom.
>>
>



Nov 18 '05 #9
Consider....

Server.Execute("yourinclude.aspx")

Probably not considered the best way to do it... but ... should do what you
are trying to accomplish.

"tshad" <ts**********@ftsolutions.com> wrote in message
news:e9*************@TK2MSFTNGP12.phx.gbl...
"Kevin Spencer" <ks******@takempis.com> wrote in message
news:ex**************@TK2MSFTNGP09.phx.gbl...
You are really very likely to have beaucoups problems if you continue to
use
an object-oriented technology in a procedural way. Kind of like trying to
drive a car with an automatic transmission by shifting the gears.


But then how am I going to be able to call different "includes" based on
some criteria (passed, read from a file etc) - or can I?

This seems like I pretty simple thing to do (but the simple things usually
tend to be the most difficult).

Tom

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Neither a follower
nor a lender be.

"tshad" <ts**********@ftsolutions.com> wrote in message
news:Op**************@tk2msftngp13.phx.gbl...
"Scott Allen" <bitmask@[nospam].fred.net> wrote in message
news:e8********************************@4ax.com...
> Hi Tom:
>
> In the long run, you'll do best to move from using include files to
> using User Controls and/or Server Controls. User controls are easy to
> create and consume.

I tried that and they work great. But the whole reason for using my

include
files was to be able to call different include files from the same
routine
based on who the client is (this was why I was not using the passed
variable - I hadn't got that far yet).

Now I am having the problem with my include statement when I want to

change
the file name it calls.

Here is the .ascx file:

************************************************** **************************
*****
<Script runat="server">
Public ClientName As String = "Staff"
</Script>

<!-- #include file = ..\includes\<%=ClientName%>Headers.inc -->

************************************************** **************************
*****

This gives me an error:

************************************************** **************************
*****
Parser Error Message: Illegal characters in path.

Source Error:

Line 3: </Script>
Line 4:
Line 5: <!-- #include file = ..\includes\<%=ClientName%>Headers.inc -->

************************************************** **************************
*****

How can I get this statement to work with variable file names
(staffheaders.inc, employeeheaders.inc, etc.).

Thanks,

Tom.
>
>

http://msdn.microsoft.com/library/de...ercontrols.asp
>
> --
> Scott
> http://www.OdeToCode.com/blogs/scott/
>
> On Fri, 19 Nov 2004 12:57:33 -0800, "tshad"
> <ts**********@ftsolutions.com> wrote:
>
>>I am not sure why I am getting this error:
>>
>>I have the following code I want to run from another include file that
>>holds
>>all my functions.
>>
>>functions.inc

********************************************** ****************************

**********
>><Script runat="Server">
>>Sub fnHeader(client As String)
>> response.write("<!-- #include file =
>> ../includes/staffingHeaders.inc -->")
>>end function
>>
>>function fnFooter(client As String)
>> response.write("<!-- #include file =
>> ../includes/staffingFooters.inc -->")
>>end function
>></script>

********************************************** ****************************

**********
>>
>>My pages would look something like:
>>

********************************************** ****************************

***
>><!-- #include file = ../includes/functions.inc -->
>><%@ Page Language="VB" AutoEventWireup="true" ContentType="text/html"
>>ResponseEncoding="iso-8859-1" %>
>><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
>><html>
>>...
>>
>><%
>> Call fnHeader("Richard")
>>%>
>>
>>... Code specific to this page
>>
>><%
>> Call fnFooter("Richard")
>>%>
>>
>>...
>></html>

********************************************** ****************************

****
>>
>>The calls would put an include file at that point which has some
>>generic
>>HTML code or ASP.NET code in it.
>>
>>The problem is I get the following 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: Server includes are not allowed in server script
>>tags.
>>
>>Source Error:
>>
>>Line 1: <Script runat="Server">
>>Line 2: Sub fnHeader(client As String)
>>Line 3: response.write("<!-- #include file =
>>../includes/staffingHeaders.inc -->")
>>Line 4: end function
>>Line 5:
>>
>>
>>Source File: c:\inetpub\wwwroot\development\includes\functions. inc
>>Line:
>>3
>>************************************************ ******************
>>
>>Why do I get this and is there a way to do what I want to do?
>>
>>Thanks,
>>
>>Tom.
>>
>



Nov 18 '05 #10
> But then how am I going to be able to call different "includes" based on
some criteria (passed, read from a file etc) - or can I?
You're not thinking 4th-dimensionally, my friend! Includes in Classic ASP is
a way of sharing code among different pages. In OOP, you would use classes
to do that. Don't think "code," think "objects."

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Neither a follower
nor a lender be.

"tshad" <ts**********@ftsolutions.com> wrote in message
news:e9*************@TK2MSFTNGP12.phx.gbl... "Kevin Spencer" <ks******@takempis.com> wrote in message
news:ex**************@TK2MSFTNGP09.phx.gbl...
You are really very likely to have beaucoups problems if you continue to
use
an object-oriented technology in a procedural way. Kind of like trying to
drive a car with an automatic transmission by shifting the gears.


But then how am I going to be able to call different "includes" based on
some criteria (passed, read from a file etc) - or can I?

This seems like I pretty simple thing to do (but the simple things usually
tend to be the most difficult).

Tom

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Neither a follower
nor a lender be.

"tshad" <ts**********@ftsolutions.com> wrote in message
news:Op**************@tk2msftngp13.phx.gbl...
"Scott Allen" <bitmask@[nospam].fred.net> wrote in message
news:e8********************************@4ax.com...
> Hi Tom:
>
> In the long run, you'll do best to move from using include files to
> using User Controls and/or Server Controls. User controls are easy to
> create and consume.

I tried that and they work great. But the whole reason for using my

include
files was to be able to call different include files from the same
routine
based on who the client is (this was why I was not using the passed
variable - I hadn't got that far yet).

Now I am having the problem with my include statement when I want to

change
the file name it calls.

Here is the .ascx file:

************************************************** ************************** *****
<Script runat="server">
Public ClientName As String = "Staff"
</Script>

<!-- #include file = ..\includes\<%=ClientName%>Headers.inc -->

************************************************** ************************** *****

This gives me an error:

************************************************** ************************** *****
Parser Error Message: Illegal characters in path.

Source Error:

Line 3: </Script>
Line 4:
Line 5: <!-- #include file = ...\includes\<%=ClientName%>Headers.inc -->

************************************************** ************************** *****

How can I get this statement to work with variable file names
(staffheaders.inc, employeeheaders.inc, etc.).

Thanks,

Tom.
>
>

http://msdn.microsoft.com/library/de...ercontrols.asp
>
> --
> Scott
> http://www.OdeToCode.com/blogs/scott/
>
> On Fri, 19 Nov 2004 12:57:33 -0800, "tshad"
> <ts**********@ftsolutions.com> wrote:
>
>>I am not sure why I am getting this error:
>>
>>I have the following code I want to run from another include file that >>holds
>>all my functions.
>>
>>functions.inc
*********************************************** ************************** * **********
>><Script runat="Server">
>>Sub fnHeader(client As String)
>> response.write("<!-- #include file =
>> ../includes/staffingHeaders.inc -->")
>>end function
>>
>>function fnFooter(client As String)
>> response.write("<!-- #include file =
>> ../includes/staffingFooters.inc -->")
>>end function
>></script>
*********************************************** **************************
*
**********
>>
>>My pages would look something like:
>>
*********************************************** **************************
* ***
>><!-- #include file = ../includes/functions.inc -->
>><%@ Page Language="VB" AutoEventWireup="true"
ContentType="text/html" >>ResponseEncoding="iso-8859-1" %>
>><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
>><html>
>>...
>>
>><%
>> Call fnHeader("Richard")
>>%>
>>
>>... Code specific to this page
>>
>><%
>> Call fnFooter("Richard")
>>%>
>>
>>...
>></html>

*********************************************** ************************** * ****
>>
>>The calls would put an include file at that point which has some
>>generic
>>HTML code or ASP.NET code in it.
>>
>>The problem is I get the following 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: Server includes are not allowed in server script >>tags.
>>
>>Source Error:
>>
>>Line 1: <Script runat="Server">
>>Line 2: Sub fnHeader(client As String)
>>Line 3: response.write("<!-- #include file =
>>../includes/staffingHeaders.inc -->")
>>Line 4: end function
>>Line 5:
>>
>>
>>Source File: c:\inetpub\wwwroot\development\includes\functions. inc
>>Line:
>>3
>>************************************************ ******************
>>
>>Why do I get this and is there a way to do what I want to do?
>>
>>Thanks,
>>
>>Tom.
>>
>



Nov 18 '05 #11
"Kevin Spencer" <ks******@takempis.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
But then how am I going to be able to call different "includes" based on
some criteria (passed, read from a file etc) - or can I?
You're not thinking 4th-dimensionally, my friend! Includes in Classic ASP
is
a way of sharing code among different pages. In OOP, you would use classes
to do that. Don't think "code," think "objects."


I am trying.

My question is why doesn't it work?

It should work?

I am going to (and have already started playing with the user control), but
this should still work and I need to find out why it doesn't as it also
doesn't work for some other tags.

I was trying to make this work with another page where I was generating the
HTML page by writing out the html code to a file I was email. The problem
was I got the same type of error trying to set the string to another tag (I
think it was the script tag).

Something is causing me to not be able to set up a string with these tags.

Thanks,

Tom.
--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Neither a follower
nor a lender be.

"tshad" <ts**********@ftsolutions.com> wrote in message
news:e9*************@TK2MSFTNGP12.phx.gbl...
"Kevin Spencer" <ks******@takempis.com> wrote in message
news:ex**************@TK2MSFTNGP09.phx.gbl...
> You are really very likely to have beaucoups problems if you continue
> to
> use
> an object-oriented technology in a procedural way. Kind of like trying to > drive a car with an automatic transmission by shifting the gears.


But then how am I going to be able to call different "includes" based on
some criteria (passed, read from a file etc) - or can I?

This seems like I pretty simple thing to do (but the simple things
usually
tend to be the most difficult).

Tom
>
> --
> HTH,
> Kevin Spencer
> .Net Developer
> Microsoft MVP
> Neither a follower
> nor a lender be.
>
> "tshad" <ts**********@ftsolutions.com> wrote in message
> news:Op**************@tk2msftngp13.phx.gbl...
>> "Scott Allen" <bitmask@[nospam].fred.net> wrote in message
>> news:e8********************************@4ax.com...
>> > Hi Tom:
>> >
>> > In the long run, you'll do best to move from using include files to
>> > using User Controls and/or Server Controls. User controls are easy
>> > to
>> > create and consume.
>>
>> I tried that and they work great. But the whole reason for using my
> include
>> files was to be able to call different include files from the same
>> routine
>> based on who the client is (this was why I was not using the passed
>> variable - I hadn't got that far yet).
>>
>> Now I am having the problem with my include statement when I want to
> change
>> the file name it calls.
>>
>> Here is the .ascx file:
>>
>>
> ************************************************** ************************** > *****
>> <Script runat="server">
>> Public ClientName As String = "Staff"
>> </Script>
>>
>> <!-- #include file = ..\includes\<%=ClientName%>Headers.inc -->
>>
> ************************************************** ************************** > *****
>>
>> This gives me an error:
>>
>>
> ************************************************** ************************** > *****
>> Parser Error Message: Illegal characters in path.
>>
>> Source Error:
>>
>> Line 3: </Script>
>> Line 4:
>> Line 5: <!-- #include file = ..\includes\<%=ClientName%>Headers.inc --> >>
> ************************************************** ************************** > *****
>>
>> How can I get this statement to work with variable file names
>> (staffheaders.inc, employeeheaders.inc, etc.).
>>
>> Thanks,
>>
>> Tom.
>> >
>> >
> http://msdn.microsoft.com/library/de...ercontrols.asp >> >
>> > --
>> > Scott
>> > http://www.OdeToCode.com/blogs/scott/
>> >
>> > On Fri, 19 Nov 2004 12:57:33 -0800, "tshad"
>> > <ts**********@ftsolutions.com> wrote:
>> >
>> >>I am not sure why I am getting this error:
>> >>
>> >>I have the following code I want to run from another include file that >> >>holds
>> >>all my functions.
>> >>
>> >>functions.inc
>>

********************************************** *************************** * > **********
>> >><Script runat="Server">
>> >>Sub fnHeader(client As String)
>> >> response.write("<!-- #include file =
>> >> ../includes/staffingHeaders.inc -->")
>> >>end function
>> >>
>> >>function fnFooter(client As String)
>> >> response.write("<!-- #include file =
>> >> ../includes/staffingFooters.inc -->")
>> >>end function
>> >></script>
>>

********************************************** *************************** * > **********
>> >>
>> >>My pages would look something like:
>> >>
>>

********************************************** *************************** * > ***
>> >><!-- #include file = ../includes/functions.inc -->
>> >><%@ Page Language="VB" AutoEventWireup="true" ContentType="text/html" >> >>ResponseEncoding="iso-8859-1" %>
>> >><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
>> >><html>
>> >>...
>> >>
>> >><%
>> >> Call fnHeader("Richard")
>> >>%>
>> >>
>> >>... Code specific to this page
>> >>
>> >><%
>> >> Call fnFooter("Richard")
>> >>%>
>> >>
>> >>...
>> >></html>
>>

********************************************** *************************** * > ****
>> >>
>> >>The calls would put an include file at that point which has some
>> >>generic
>> >>HTML code or ASP.NET code in it.
>> >>
>> >>The problem is I get the following 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: Server includes are not allowed in server script >> >>tags.
>> >>
>> >>Source Error:
>> >>
>> >>Line 1: <Script runat="Server">
>> >>Line 2: Sub fnHeader(client As String)
>> >>Line 3: response.write("<!-- #include file =
>> >>../includes/staffingHeaders.inc -->")
>> >>Line 4: end function
>> >>Line 5:
>> >>
>> >>
>> >>Source File: c:\inetpub\wwwroot\development\includes\functions. inc
>> >>Line:
>> >>3
>> >>************************************************ ******************
>> >>
>> >>Why do I get this and is there a way to do what I want to do?
>> >>
>> >>Thanks,
>> >>
>> >>Tom.
>> >>
>> >
>>
>>
>
>



Nov 18 '05 #12
> My question is why doesn't it work?

Why doesn't what work?

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Neither a follower
nor a lender be.

"tshad" <ts**********@ftsolutions.com> wrote in message
news:e3**************@TK2MSFTNGP09.phx.gbl...
"Kevin Spencer" <ks******@takempis.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
But then how am I going to be able to call different "includes" based on some criteria (passed, read from a file etc) - or can I?
You're not thinking 4th-dimensionally, my friend! Includes in Classic ASP
is
a way of sharing code among different pages. In OOP, you would use classes to do that. Don't think "code," think "objects."


I am trying.

My question is why doesn't it work?

It should work?

I am going to (and have already started playing with the user control),

but this should still work and I need to find out why it doesn't as it also
doesn't work for some other tags.

I was trying to make this work with another page where I was generating the HTML page by writing out the html code to a file I was email. The problem
was I got the same type of error trying to set the string to another tag (I think it was the script tag).

Something is causing me to not be able to set up a string with these tags.

Thanks,

Tom.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Neither a follower
nor a lender be.

"tshad" <ts**********@ftsolutions.com> wrote in message
news:e9*************@TK2MSFTNGP12.phx.gbl...
"Kevin Spencer" <ks******@takempis.com> wrote in message
news:ex**************@TK2MSFTNGP09.phx.gbl...
> You are really very likely to have beaucoups problems if you continue
> to
> use
> an object-oriented technology in a procedural way. Kind of like trying
to
> drive a car with an automatic transmission by shifting the gears.

But then how am I going to be able to call different "includes" based
on some criteria (passed, read from a file etc) - or can I?

This seems like I pretty simple thing to do (but the simple things
usually
tend to be the most difficult).

Tom

>
> --
> HTH,
> Kevin Spencer
> .Net Developer
> Microsoft MVP
> Neither a follower
> nor a lender be.
>
> "tshad" <ts**********@ftsolutions.com> wrote in message
> news:Op**************@tk2msftngp13.phx.gbl...
>> "Scott Allen" <bitmask@[nospam].fred.net> wrote in message
>> news:e8********************************@4ax.com...
>> > Hi Tom:
>> >
>> > In the long run, you'll do best to move from using include files to >> > using User Controls and/or Server Controls. User controls are easy
>> > to
>> > create and consume.
>>
>> I tried that and they work great. But the whole reason for using my
> include
>> files was to be able to call different include files from the same
>> routine
>> based on who the client is (this was why I was not using the passed
>> variable - I hadn't got that far yet).
>>
>> Now I am having the problem with my include statement when I want to
> change
>> the file name it calls.
>>
>> Here is the .ascx file:
>>
>>
>

************************************************** **************************
> *****
>> <Script runat="server">
>> Public ClientName As String = "Staff"
>> </Script>
>>
>> <!-- #include file = ..\includes\<%=ClientName%>Headers.inc -->
>>
>

************************************************** **************************
> *****
>>
>> This gives me an error:
>>
>>
>

************************************************** **************************
> *****
>> Parser Error Message: Illegal characters in path.
>>
>> Source Error:
>>
>> Line 3: </Script>
>> Line 4:
>> Line 5: <!-- #include file =

..\includes\<%=ClientName%>Headers.inc -->
>>
>

************************************************** **************************
> *****
>>
>> How can I get this statement to work with variable file names
>> (staffheaders.inc, employeeheaders.inc, etc.).
>>
>> Thanks,
>>
>> Tom.
>> >
>> >
>

http://msdn.microsoft.com/library/de...ercontrols.asp
>> >
>> > --
>> > Scott
>> > http://www.OdeToCode.com/blogs/scott/
>> >
>> > On Fri, 19 Nov 2004 12:57:33 -0800, "tshad"
>> > <ts**********@ftsolutions.com> wrote:
>> >
>> >>I am not sure why I am getting this error:
>> >>
>> >>I have the following code I want to run from another include file

that
>> >>holds
>> >>all my functions.
>> >>
>> >>functions.inc
>>
********************************************** **************************
* *
> **********
>> >><Script runat="Server">
>> >>Sub fnHeader(client As String)
>> >> response.write("<!-- #include file =
>> >> ../includes/staffingHeaders.inc -->")
>> >>end function
>> >>
>> >>function fnFooter(client As String)
>> >> response.write("<!-- #include file =
>> >> ../includes/staffingFooters.inc -->")
>> >>end function
>> >></script>
>>
********************************************** **************************
* *
> **********
>> >>
>> >>My pages would look something like:
>> >>
>>
********************************************** **************************
* *
> ***
>> >><!-- #include file = ../includes/functions.inc -->
>> >><%@ Page Language="VB" AutoEventWireup="true"

ContentType="text/html"
>> >>ResponseEncoding="iso-8859-1" %>
>> >><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
>> >><html>
>> >>...
>> >>
>> >><%
>> >> Call fnHeader("Richard")
>> >>%>
>> >>
>> >>... Code specific to this page
>> >>
>> >><%
>> >> Call fnFooter("Richard")
>> >>%>
>> >>
>> >>...
>> >></html>
>>
********************************************** **************************
* *
> ****
>> >>
>> >>The calls would put an include file at that point which has some
>> >>generic
>> >>HTML code or ASP.NET code in it.
>> >>
>> >>The problem is I get the following 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: Server includes are not allowed in server

script
>> >>tags.
>> >>
>> >>Source Error:
>> >>
>> >>Line 1: <Script runat="Server">
>> >>Line 2: Sub fnHeader(client As String)
>> >>Line 3: response.write("<!-- #include file =
>> >>../includes/staffingHeaders.inc -->")
>> >>Line 4: end function
>> >>Line 5:
>> >>
>> >>
>> >>Source File: c:\inetpub\wwwroot\development\includes\functions. inc
>> >>Line:
>> >>3
>> >>************************************************ ******************
>> >>
>> >>Why do I get this and is there a way to do what I want to do?
>> >>
>> >>Thanks,
>> >>
>> >>Tom.
>> >>
>> >
>>
>>
>
>



Nov 18 '05 #13

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

Similar topics

1
by: qwejohn | last post by:
Hello, I had posted this question in the twisted mailing list but did not got a solution ; I hope that the python Gurus of this forum can help me a bit. I am trying the exmaple in the python...
9
by: Martin Plechsmid | last post by:
Hello. I've got IIS5, both at work and in my home, and I use JScript as the primary scripting language in ASP. When a function is defined in an included file, say inc_dosth.asp: <SCRIPT...
5
by: Vilmar Brazão de Oliveira | last post by:
Hi, I know this kind of include <!--#include file="adovbs.inc"--> or <!-- #include file="conn_dbAT.asp" --> is put into my asp page, but this bellow let my slow too?? <script...
25
by: Martin Walke | last post by:
Hi, This may seem like a client side problem but.... I have web pages that are made up of a number of javascript include files as well as 'in page' script. They all work fine running locally...
3
by: Peter | last post by:
Hello: I've just asked a question about the includes, and I appreciate your help very much. However, this still doesn't work for me. What am I doing wrong? I have a script that should go...
7
by: McKirahan | last post by:
Has anyone experienced this (and found a solution)? I have five files: a .htm that invokes four .js include files. Only the first alert in the first include is displayed. This only happens...
3
by: catlover30 | last post by:
I am creating a website using DIV tags for the layout, and attaching the template to a CSS style sheet. I was given an html file that already included the banner and server side includes for...
6
by: MaiyaHolliday | last post by:
Hello, I've recently installed apache on a new computer, and cannot figure out why my site will not process any includes. (it was working on my old one) There are no errors on the page such as...
3
by: graphicssl | last post by:
Okay, so first of all, I'm a designer first and a light coder second (I'm only really trained with HTML and CSS). So I apologize for having to post about something that's probably super-trivial! ...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.