PC Review


Reply
Thread Tools Rate Thread

Includes not allowed in Server Script tags

 
 
tshad
Guest
Posts: n/a
 
      19th Nov 2004
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.


 
Reply With Quote
 
 
 
 
Scott Allen
Guest
Posts: n/a
 
      19th Nov 2004
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"
<(E-Mail Removed)> 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.
>


 
Reply With Quote
 
 
 
 
Jeff Dillon
Guest
Posts: n/a
 
      19th Nov 2004
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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.
>
>



 
Reply With Quote
 
tshad
Guest
Posts: n/a
 
      19th Nov 2004
"Scott Allen" <bitmask@[nospam].fred.net> wrote in message
news:(E-Mail Removed)...
> 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"
> <(E-Mail Removed)> 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.
>>

>



 
Reply With Quote
 
tshad
Guest
Posts: n/a
 
      19th Nov 2004
"Jeff Dillon" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> 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.
>>
>>

>
>



 
Reply With Quote
 
Kevin Spencer
Guest
Posts: n/a
 
      19th Nov 2004
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> "Scott Allen" <bitmask@[nospam].fred.net> wrote in message
> news:(E-Mail Removed)...
> > 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"
> > <(E-Mail Removed)> 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.
> >>

> >

>
>



 
Reply With Quote
 
tshad
Guest
Posts: n/a
 
      19th Nov 2004
"Kevin Spencer" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> "Scott Allen" <bitmask@[nospam].fred.net> wrote in message
>> news:(E-Mail Removed)...
>> > 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"
>> > <(E-Mail Removed)> 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.
>> >>
>> >

>>
>>

>
>



 
Reply With Quote
 
=?Utf-8?B?V2ViTWF0cml4?=
Guest
Posts: n/a
 
      20th Nov 2004
> 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.
 
Reply With Quote
 
Scott Allen
Guest
Posts: n/a
 
      20th Nov 2004
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"
<(E-Mail Removed)> wrote:

>"Kevin Spencer" <(E-Mail Removed)> wrote in message
>news:(E-Mail Removed)...
>> 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" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> "Scott Allen" <bitmask@[nospam].fred.net> wrote in message
>>> news:(E-Mail Removed)...
>>> > 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"
>>> > <(E-Mail Removed)> 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.
>>> >>
>>> >
>>>
>>>

>>
>>

>


 
Reply With Quote
 
Scott Tuttle
Guest
Posts: n/a
 
      22nd Nov 2004
Consider....

Server.Execute("yourinclude.aspx")

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

"tshad" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> "Kevin Spencer" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> 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" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> "Scott Allen" <bitmask@[nospam].fred.net> wrote in message
>>> news:(E-Mail Removed)...
>>> > 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"
>>> > <(E-Mail Removed)> 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.
>>> >>
>>> >
>>>
>>>

>>
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Conversion of access data that includes html tags andromeda Microsoft Access External Data 0 24th Dec 2009 05:21 PM
to be or not be or allowed or not allowed =?Utf-8?B?SmFuIHRoZSBEdXRjaG1hbg==?= Security and Anti-Spyware Community 4 19th Apr 2006 12:36 AM
Using <Script> tags to calls a script from another server Chuck Microsoft ASP .NET 2 12th Nov 2004 11:57 PM
FP-XP Fp Includes vs. SSI includes Bob Microsoft Frontpage 4 19th Mar 2004 08:10 PM
how to select cells which includes includes date for e.g. 1/1/2003 jerry1480 Microsoft Excel Worksheet Functions 3 30th Oct 2003 04:43 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:40 AM.