包含Server Script标记中不允许的内容 [英] Includes not allowed in Server Script tags

查看:63
本文介绍了包含Server Script标记中不允许的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道为什么会收到此错误:


我有以下代码我想从另一个包含文件运行

all我的职能。


functions.inc

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

< Script runat =" Server">

Sub fnHeader(client as String)

response.write("<! - #include file = ../includes/staffingHeaders.inc - >")

结束功能


函数fnFooter(客户端为字符串)

response.write("<! - #include file = ../includes/staffingFooters.inc - >")

结束功能

< / script>

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


我的页面看起来像这样:


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

<! - #incl ude file = ../includes/functions.inc - >

<%@ Page Language =" VB" AutoEventWireup = QUOT;真" ContentType =" text / html"

ResponseEncoding =" iso-8859-1" %>

<!DOCTYPE HTML PUBLIC" - // W3C // DTD HTML 4.01 Transitional // EN">

< html>

....


<%

致电fnHeader(" Richard")

%> ;


....特定于此页面的代码


<%

致电fnFooter(" Richard")

%>


....

< / html>

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


电话会在其中放入一个包含文件其中包含一些通用的

HTML代码或ASP.NET代码。


问题是我收到以下错误:

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

分析器错误
描述:解析为
服务此请求所需的资源时发生错误。请查看以下特定的解析错误

详细信息并适当修改源文件。


解析器错误消息:服务器脚本标记中不允许包含服务器。


来源错误:


第1行:<脚本runat ="服务器">

第2行:Sub fnHeader(client as String)

第3行:response.write("<! - #include file =

... / includes / staffingHeaders。 inc - >")

第4行:结束函数

第5行:

源文件:c:\inetpub \ wwwroot\development\includes\functions。公司专线:

3

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


为什么这样做我得到了这个,有办法做我想做的事吗?


谢谢,


汤姆。

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.

推荐答案

嗨Tom:


从长远来看,你最好从使用包含文件转到

使用用户控件和/或服务器控件。用户控件很容易创建和使用。

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


-

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

周五,2004年11月19日12:57:33 -0800," ; tshad"

< ts ********** @ ftsolutions.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.

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:
我不知道为什么我会收到此错误:

我想要从另一个包含我的所有功能。

functions.inc
***************************** ******************** ****************************** *****
< Script runat =" Server">
Sub fnHeader(client as String)
response.write("<! - #include file = ../includes/staffingHeaders.inc - >")
函数fnFooter(client as String)
response.write("< ;! - - #include file = ../includes/staffingFooters.inc - >")
结束功能
< / script>
*********** ************************************** ************ ***********************

我的网页看起来像是:

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

<%
致电fnHeader(" Richard")
%>

...特定于此页的代码

<%
调用fnFooter(" Richard")
%>

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

这些电话会在那个地方放一个包含文件,里面有一些通用的
HTML代码或ASP.NET代码。

问题是我收到以下错误:
******************* ****************************** ******************** ****************
分析程序错误
描述:解析为此请求提供服务所需的资源时发生错误。请查看以下特定的解析错误
详细信息并适当修改源文件。

解析器错误消息:服务器脚本标记中不允许包含服务器。

来源错误:

第1行:<脚本runat ="服务器">
第2行:子fnHeader(客户端为字符串)
第3行:response.write(" ;< ;! - #include file =
../includes/staffingHeaders.inc - >")
第4行:结束功能
第5行:

源文件:c:\inetpub \ www.root \development \includes \ functions。公司专线:
3
************************************** *********** *****************

为什么我得到这个,有没有办法做我的事想做什么?

谢谢,

汤姆。
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.






你通过了fnHeader的参数(客户端作为字符串)但随后随后

忽略它?


由于似乎没有基于参数的分支逻辑,为什么不呢? />
只需按常规包含文件?


Jeff

" tshad" < TS ********** @ ftsolutions.com>在消息中写道

新闻:eq ************** @ TK2MSFTNGP09.phx.gbl ...
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...
我不知道为什么我收到这个错误:

我有以下代码我想从另一个包含文件运行,
包含我的所有功能。

functions.inc

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

********<脚本runat =" Server">
Sub fnHeader(client as String)
response.write("<! - #include file =
... / includes / staffingHeaders .inc - >")结束函数

函数fnFooter(client as String)
response.write("<! - #include file =
。 ../includes/staffingFooters.inc - >")结束函数
< / script>

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

********
我的页面看起来像:


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

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

<%
致电fnHeader(" Richard")
%>

...特定于此页的代码

<%
调用fnFooter(" Richard")
%>

...
< / html>

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

**
这些电话会在那时放一个包含文件其中包含一些通用的HTML代码或ASP.NET代码。

问题是我收到以下错误:

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

*********分析器错误
描述:解析过程中出错资源需要
来处理此请求。请查看以下特定的解析错误
详细信息并适当修改源文件。

解析器错误消息:服务器脚本
标签中不允许包含服务器。
来源错误:

第1行:<脚本runat ="服务器">
第2行:子fnHeader(客户端为字符串)
第3行:response.write(" ;< ;! - #include file =
../includes/staffingHeaders.inc - >")
第4行:结束功能
第5行:

源文件:c:\inetpub \ www.root \development \includes \ functions。 inc
行:3
************************************** ************ ****************

为什么我会这样做,有办法做我的事想做什么?

谢谢,

Tom。
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.



" Scott艾伦QUOT; <位掩码@ [NOSPAM] .fred.net>在留言中写道

新闻:e8 ******************************** @ 4ax.com ...
"Scott Allen" <bitmask@[nospam].fred.net> wrote in message
news:e8********************************@4ax.com...
嗨Tom:

从长远来看,你最好从使用包含文件转到
使用用户控件和/或服务器控件。用户控件易于创建和使用。


我试过了,他们工作得很好。但是使用我的包含

文件的全部原因是能够根据客户端来调用来自同一例程的不同包含文件

(这就是为什么我是没有使用传递的

变量 - 我还没有那么远。


现在我想要包含我的include语句的问题更改

它调用的文件名。


这是.ascx文件:


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

< Script runat =" server">

Public ClientName As String =" Staff"

< / Script>


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

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


这给了我一个错误:


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

解析器错误消息:路径中的字符非法。


源错误:


第3行:< / Script>

第4行:

第5行:<! - #include file = .. \\ \\includes \<%= ClientName%> Headers.inc - >

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


如何使用此语句处理变量文件名

(staffheaders.inc,employeeheaders.inc等。)。


谢谢,


汤姆。
http://msdn.microsoft.com/library/de ... ercontrols.asp

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

2004年11月19日星期五12:57:33 -0800,tshad ;
< ; TS ********** @ ftsolutions.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:
我不知道为什么我收到此错误:

我有以下代码我想从另一个包含文件运行
拥有我所有的功能。

functions.inc
************************* *********************** *************************** *********
< Script runat =" Server">
Sub fnHeader(client as String)
response.write("< ;! - #include file =
../includes/staffingHeaders.inc - >")
结束函数

函数fnFooter(client as String)
响应。写("! - #include file =
../includes/staffingFooters.inc - >")
结束函数
< / script>
************************************************ * *************************************

我的网页看起来像是这样的:

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

<%
致电fnHeader(" Richard")
%>

...特定于此页的代码

<%
调用fnFooter(" Richard")
%>

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

这些电话会在那个地方放一个包含文件,里面有一些通用的
HTML代码或ASP.NET代码。

问题是我收到以下错误:
******************* ***************************** ********************* ****************
分析器错误
描述:解析所需资源时出错
为此请求提供服务。请查看以下特定的解析错误
详细信息并适当修改源文件。

解析器错误消息:服务器包含在服务器脚本中不允许使用
标签。
<源错误:

第1行:<脚本runat ="服务器">
第2行:子fnHeader(客户端为字符串)
第3行:响应.write("! - #include file =
../includes/staffingHeaders.inc - >")
第4行:结束功能
第5行:

源文件:c:\inetpub \ www.root \development \includes \ functions。公司
线路:
3
********************************** ************** ******************

为什么我会这样做,有办法吗?做我想做的事情?

谢谢,

Tom。
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.



这篇关于包含Server Script标记中不允许的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆