Re: Includes not allowed in Server Script tags

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Kevin Spencer (kspencer_at_takempis.com)
Date: 11/19/04


Date: Fri, 19 Nov 2004 17:16:53 -0500

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" <tscheiderich@ftsolutions.com> wrote in message
news:OpqZ7GozEHA.1396@tk2msftngp13.phx.gbl...
> "Scott Allen" <bitmask@[nospam].fred.net> wrote in message
> news:e8osp0ptf0ksls9eavoheclqm7olfv6d3t@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/default.asp?url=/library/en-us/cpguide/html/cpconwebformsusercontrols.asp
> >
> > --
> > Scott
> > http://www.OdeToCode.com/blogs/scott/
> >
> > On Fri, 19 Nov 2004 12:57:33 -0800, "tshad"
> > <tscheiderich@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.
> >>
> >
>
>


Relevant Pages

  • Re: Using Eval to create an Array
    ... Needed to change the server side code to output a string such as ... It was supposed to result in an array that I could loop through. ... Instead it was resulting into a parser error. ...
    (comp.lang.javascript)
  • Re: Help with parsing error?
    ... > I get the following error on the server: ... Hi, Brett. ... > Parser Error Message: ... > Source Error: ...
    (microsoft.public.dotnet.framework.aspnet)
  • SQL Connection Problem
    ... An error has occurred while establishing a connection to the server. ... database location within the applications App_Data directory. ... Boolean& failoverDemandDone, String host, String failoverPartner, String ... user, String password, Boolean trusted, String connectionString) +68 ...
    (microsoft.public.dotnet.framework.aspnet)
  • server-side JavaScript: Prototypes of built-in classes, objects and functins
    ... Session object (disk-based session variables for data persistence ... File class (manipulation of files on server, ie. open, close, read, ... //Methods Cgi.queryCgi.postCgi.anyby default return an empty string if requested var not found ...
    (comp.lang.javascript)
  • Re: App_data - ASPNETDB.MDF
    ... is only because I want my site work, without exception. ... Server Error in '/' Application. ... serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 ...
    (microsoft.public.dotnet.framework.aspnet)