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

Unable to set a string to Include statement

In my User control, I tried to do this:
************************************************** *************************
<Script runat="server">
Public ClientName As String = "<!-- #include file =
...\includes\StaffingHeaders.inc -->"

</Script>

<%=ClientName%>
************************************************** **************************

This gives me:

Parser Error Message: Server includes are not allowed in server script
tags.
If I try to do it this way:
In my User control, I tried to do this:
************************************************** *************************
<Script runat="server">
Public ClientName As String = "<!-- #" & "include file =
...\includes\StaffingHeaders.inc -->"

</Script>

<%=ClientName%>
************************************************** **************************

It gives me nothing

If I do this:
************************************************** *************************
<Script runat="server">
Public ClientName As String = "!-- #" & "include file =
...\includes\StaffingHeaders.inc -->"

</Script>

<%=ClientName%>
************************************************** **************************
As I would expect, it displays:

"!-- #include file = ..\includes\StaffingHeaders.inc -->

But as soon as I add the "<", I get the error.

This should just be a string, why isn't it?

Tom
Nov 18 '05 #1
6 2072
What in the world are you trying to do?
It looks like you want to add an include file in your page. Which, I think,
is still allowed in
ASP.NET for backward compatibility. But that's the only reason why it's
there, you should not be using in ASP.NET.

If you want just to have include file in your page just add
<!-- #include file ="...\includes\StaffingHeaders.inc"> OUTSIDE server script.

This line will be Parsed by ASP and hopefully .inc file will be executed.
But Response.Write which you were doing in your examples will simply send
that string to the browser.

My advise don't use includes in .NET, since it's really old 'classic' asp
feature. Instead adopt OO programming approach.

"tshad" wrote:
In my User control, I tried to do this:
************************************************** *************************
<Script runat="server">
Public ClientName As String = "<!-- #include file =
...\includes\StaffingHeaders.inc -->"

</Script>

<%=ClientName%>
************************************************** **************************

This gives me:

Parser Error Message: Server includes are not allowed in server script
tags.
If I try to do it this way:
In my User control, I tried to do this:
************************************************** *************************
<Script runat="server">
Public ClientName As String = "<!-- #" & "include file =
...\includes\StaffingHeaders.inc -->"

</Script>

<%=ClientName%>
************************************************** **************************

It gives me nothing

If I do this:
************************************************** *************************
<Script runat="server">
Public ClientName As String = "!-- #" & "include file =
...\includes\StaffingHeaders.inc -->"

</Script>

<%=ClientName%>
************************************************** **************************
As I would expect, it displays:

"!-- #include file = ..\includes\StaffingHeaders.inc -->

But as soon as I add the "<", I get the error.

This should just be a string, why isn't it?

Tom

Nov 18 '05 #2
"WebMatrix" <We*******@discussions.microsoft.com> wrote in message
news:9A**********************************@microsof t.com...
What in the world are you trying to do?
It looks like you want to add an include file in your page. Which, I
think,
is still allowed in
ASP.NET for backward compatibility. But that's the only reason why it's
there, you should not be using in ASP.NET.

If you want just to have include file in your page just add
<!-- #include file ="...\includes\StaffingHeaders.inc"> OUTSIDE server
script.

This line will be Parsed by ASP and hopefully .inc file will be executed.
But Response.Write which you were doing in your examples will simply send
that string to the browser.

My advise don't use includes in .NET, since it's really old 'classic' asp
feature. Instead adopt OO programming approach.
Actually, that is what I am in the midst of doing now.

My question is why would the parser give me an error on setting up the
string?

If it is in quotes, why would it not accept it?

Isn't the following a valid string?

Public ClientName As String = "<!-- #include file =
....\includes\StaffingHeaders.inc -->"

Also, assuming I can set a variable to the inlude string, outside of the
Script tags, isn't:

<!-- #include file = ...\includes\StaffingHeaders.inc -->

the same as:

<%=ClientName%>.

I was under the impression (and I could be wrong) that <%ClientName%> would
be replaced with:

<!-- #include file = ...\includes\StaffingHeaders.inc -->

Am I wrong here?

Thanks,

Tom


"tshad" wrote:
In my User control, I tried to do this:
************************************************** *************************
<Script runat="server">
Public ClientName As String = "<!-- #include file =
...\includes\StaffingHeaders.inc -->"

</Script>

<%=ClientName%>
************************************************** **************************

This gives me:

Parser Error Message: Server includes are not allowed in server script
tags.
If I try to do it this way:
In my User control, I tried to do this:
************************************************** *************************
<Script runat="server">
Public ClientName As String = "<!-- #" & "include file =
...\includes\StaffingHeaders.inc -->"

</Script>

<%=ClientName%>
************************************************** **************************

It gives me nothing

If I do this:
************************************************** *************************
<Script runat="server">
Public ClientName As String = "!-- #" & "include file =
...\includes\StaffingHeaders.inc -->"

</Script>

<%=ClientName%>
************************************************** **************************
As I would expect, it displays:

"!-- #include file = ..\includes\StaffingHeaders.inc -->

But as soon as I add the "<", I get the error.

This should just be a string, why isn't it?

Tom

Nov 18 '05 #3
You are missing 2 points:
1. Include file is a legacy asp feature, the replacement for includes in
..NET world are things like server-side user controls, and plain .NET Claasses.

2. If you absolutely must use includes then try to understand how web server
parses web pages.
Everything outside Server Script will be parsed as HTML and served to the
browser. So having
<%=ClientName%> will simply render whatever value that variable holds.
However having this text outside server side tags
<!-- #include file =" ....\includes\StaffingHeaders.inc" --> tells parser
that this is an include file that needs to be executed.

From what I am seeing, you're trying to execute certain piece of code
dynamically. I think you'll be better off investigating .NET features that
could accomplish your goal. In any case, if you provide more details on what
you're trying to accomplish perhaps someone could steer you to the right
direction.


"tshad" wrote:
"WebMatrix" <We*******@discussions.microsoft.com> wrote in message
news:9A**********************************@microsof t.com...
What in the world are you trying to do?
It looks like you want to add an include file in your page. Which, I
think,
is still allowed in
ASP.NET for backward compatibility. But that's the only reason why it's
there, you should not be using in ASP.NET.

If you want just to have include file in your page just add
<!-- #include file ="...\includes\StaffingHeaders.inc"> OUTSIDE server
script.

This line will be Parsed by ASP and hopefully .inc file will be executed.
But Response.Write which you were doing in your examples will simply send
that string to the browser.

My advise don't use includes in .NET, since it's really old 'classic' asp
feature. Instead adopt OO programming approach.


Actually, that is what I am in the midst of doing now.

My question is why would the parser give me an error on setting up the
string?

If it is in quotes, why would it not accept it?

Isn't the following a valid string?

Public ClientName As String = "<!-- #include file =
....\includes\StaffingHeaders.inc -->"

Also, assuming I can set a variable to the inlude string, outside of the
Script tags, isn't:

<!-- #include file = ...\includes\StaffingHeaders.inc -->

the same as:

<%=ClientName%>.

I was under the impression (and I could be wrong) that <%ClientName%> would
be replaced with:

<!-- #include file = ...\includes\StaffingHeaders.inc -->

Am I wrong here?

Thanks,

Tom


"tshad" wrote:
In my User control, I tried to do this:
************************************************** *************************
<Script runat="server">
Public ClientName As String = "<!-- #include file =
...\includes\StaffingHeaders.inc -->"

</Script>

<%=ClientName%>
************************************************** **************************

This gives me:

Parser Error Message: Server includes are not allowed in server script
tags.
If I try to do it this way:
In my User control, I tried to do this:
************************************************** *************************
<Script runat="server">
Public ClientName As String = "<!-- #" & "include file =
...\includes\StaffingHeaders.inc -->"

</Script>

<%=ClientName%>
************************************************** **************************

It gives me nothing

If I do this:
************************************************** *************************
<Script runat="server">
Public ClientName As String = "!-- #" & "include file =
...\includes\StaffingHeaders.inc -->"

</Script>

<%=ClientName%>
************************************************** **************************
As I would expect, it displays:

"!-- #include file = ..\includes\StaffingHeaders.inc -->

But as soon as I add the "<", I get the error.

This should just be a string, why isn't it?

Tom


Nov 18 '05 #4
"WebMatrix" <We*******@discussions.microsoft.com> wrote in message
news:B9**********************************@microsof t.com...
You are missing 2 points:
1. Include file is a legacy asp feature, the replacement for includes in
.NET world are things like server-side user controls, and plain .NET
Claasses.

2. If you absolutely must use includes then try to understand how web
server
parses web pages.
Everything outside Server Script will be parsed as HTML and served to the
browser. So having
<%=ClientName%> will simply render whatever value that variable holds.
However having this text outside server side tags
<!-- #include file =" ....\includes\StaffingHeaders.inc" --> tells parser
that this is an include file that needs to be executed.

From what I am seeing, you're trying to execute certain piece of code
dynamically. I think you'll be better off investigating .NET features that
could accomplish your goal. In any case, if you provide more details on
what
you're trying to accomplish perhaps someone could steer you to the right
direction.


Actually, I have 2 problems (but I will forgo the inability to set a string
to the include statement - which makes no sense at all).

What I am trying to do is create a general aspx page that has all my normal
processing, except for the top and bottom sections of the pages which are
the company logos, menus etc.

I want to be able go to different companies, have them give me their top
sections (headers) and bottom sections (footers). I would then include them
like so:

************************************************** ****************************************
<%@ Register TagPrefix="fts" TAgName="header"
src="..\includes\travacHeaders.ascx" %>
<%@ Register TagPrefix="fts" TAgName="footer"
src="..\includes\travacFooters.ascx" %>
<%@ Page Language="VB" trace="false" debug="true" AutoEventWireup="true"
ContentType="text/html" ResponseEncoding="iso-8859-1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<script runat="server">
sub Page_load(s as object,e as eventargs)
end sub
</script>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Home Page</title>

<!-- Clients Headers are displayed here -->
<fts:header id=ctl1 runat="Server" />

<!-- Our Content Starts Here -->
<form id="Form1" runat="server">
<input type="hidden" name="__SCROLLPOS" value="" />
<center>
<br>
</center>
</form>

<!-- Our Content Ends Here -->

<!-- Clients Footers are displayed here -->
<fts:footer id=cdl2 runat="Server" />
************************************************** ****************************************

The problem with the above code is that it works fine for only one client.
I don't want to create the above page for each client. I would have
travacHeaders.ascx for one client, staffersHeaders.ascx for another client,
etc.

Originally, I tried to set up a control to call different include files:

************************************************** *****************************************
<Script runat="server">
Public ClientName As String = "<!-- #include file " & "=
...\includes\travacHeaders.inc -->"

</Script>

<%=ClientName%>
************************************************** *****************************************

One of the problem is that ASP, won't let me set the string to the incude
statement (and you say this won't work anyway).

How do I set this up to call different controls (or include files)?

Thanks,

Tom


"tshad" wrote:
"WebMatrix" <We*******@discussions.microsoft.com> wrote in message
news:9A**********************************@microsof t.com...
> What in the world are you trying to do?
> It looks like you want to add an include file in your page. Which, I
> think,
> is still allowed in
> ASP.NET for backward compatibility. But that's the only reason why it's
> there, you should not be using in ASP.NET.
>
> If you want just to have include file in your page just add
> <!-- #include file ="...\includes\StaffingHeaders.inc"> OUTSIDE server
> script.
>
> This line will be Parsed by ASP and hopefully .inc file will be
> executed.
> But Response.Write which you were doing in your examples will simply
> send
> that string to the browser.
>
> My advise don't use includes in .NET, since it's really old 'classic'
> asp
> feature. Instead adopt OO programming approach.


Actually, that is what I am in the midst of doing now.

My question is why would the parser give me an error on setting up the
string?

If it is in quotes, why would it not accept it?

Isn't the following a valid string?

Public ClientName As String = "<!-- #include file =
....\includes\StaffingHeaders.inc -->"

Also, assuming I can set a variable to the inlude string, outside of the
Script tags, isn't:

<!-- #include file = ...\includes\StaffingHeaders.inc -->

the same as:

<%=ClientName%>.

I was under the impression (and I could be wrong) that <%ClientName%>
would
be replaced with:

<!-- #include file = ...\includes\StaffingHeaders.inc -->

Am I wrong here?

Thanks,

Tom

>
> "tshad" wrote:
>
>> In my User control, I tried to do this:
>> ************************************************** *************************
>> <Script runat="server">
>> Public ClientName As String = "<!-- #include file =
>> ...\includes\StaffingHeaders.inc -->"
>>
>> </Script>
>>
>> <%=ClientName%>
>> ************************************************** **************************
>>
>> This gives me:
>>
>> Parser Error Message: Server includes are not allowed in server
>> script
>> tags.
>>
>>
>> If I try to do it this way:
>> In my User control, I tried to do this:
>> ************************************************** *************************
>> <Script runat="server">
>> Public ClientName As String = "<!-- #" & "include file =
>> ...\includes\StaffingHeaders.inc -->"
>>
>> </Script>
>>
>> <%=ClientName%>
>> ************************************************** **************************
>>
>> It gives me nothing
>>
>> If I do this:
>> ************************************************** *************************
>> <Script runat="server">
>> Public ClientName As String = "!-- #" & "include file =
>> ...\includes\StaffingHeaders.inc -->"
>>
>> </Script>
>>
>> <%=ClientName%>
>> ************************************************** **************************
>> As I would expect, it displays:
>>
>> "!-- #include file = ..\includes\StaffingHeaders.inc -->
>>
>> But as soon as I add the "<", I get the error.
>>
>> This should just be a string, why isn't it?
>>
>> Tom
>>
>>
>>


Nov 18 '05 #5
So you are using User Control (.ascx file). Why don't you program your
control to render different content based on the client logged into your
site? For example place image control where company logo should go, and store
image name + path for each client in AppSettings section of web.config file
like that:
<add key="Client1" value = "~/images/Client1Logo.gif" />
<add key="Client2" value = "~/images/Client2Logo.gif" />

In your Control you can retrieve logo path by the client name from a
webconfig file and set ImageUrl property of your logo image control Control
like this:

imgLogo.ImageURL =
Page.resolveURL(System.Configuration.Configuration Settings.AppSettings().Item(ClientName))

Similar techniques can be applied for other dynamic elements of your control.
but I will forgo the inability to set a string to the include statement - which makes no sense at all


No it makes perfect sense. Think about it. What would happen if you did this:
Response.Write("<!--#include file=""somefile.inc"" -->")
????

"tshad" wrote:
"WebMatrix" <We*******@discussions.microsoft.com> wrote in message
news:B9**********************************@microsof t.com...
You are missing 2 points:
1. Include file is a legacy asp feature, the replacement for includes in
.NET world are things like server-side user controls, and plain .NET
Claasses.

2. If you absolutely must use includes then try to understand how web
server
parses web pages.
Everything outside Server Script will be parsed as HTML and served to the
browser. So having
<%=ClientName%> will simply render whatever value that variable holds.
However having this text outside server side tags
<!-- #include file =" ....\includes\StaffingHeaders.inc" --> tells parser
that this is an include file that needs to be executed.

From what I am seeing, you're trying to execute certain piece of code
dynamically. I think you'll be better off investigating .NET features that
could accomplish your goal. In any case, if you provide more details on
what
you're trying to accomplish perhaps someone could steer you to the right
direction.


Actually, I have 2 problems (but I will forgo the inability to set a string
to the include statement - which makes no sense at all).

What I am trying to do is create a general aspx page that has all my normal
processing, except for the top and bottom sections of the pages which are
the company logos, menus etc.

I want to be able go to different companies, have them give me their top
sections (headers) and bottom sections (footers). I would then include them
like so:

************************************************** ****************************************
<%@ Register TagPrefix="fts" TAgName="header"
src="..\includes\travacHeaders.ascx" %>
<%@ Register TagPrefix="fts" TAgName="footer"
src="..\includes\travacFooters.ascx" %>
<%@ Page Language="VB" trace="false" debug="true" AutoEventWireup="true"
ContentType="text/html" ResponseEncoding="iso-8859-1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<script runat="server">
sub Page_load(s as object,e as eventargs)
end sub
</script>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Home Page</title>

<!-- Clients Headers are displayed here -->
<fts:header id=ctl1 runat="Server" />

<!-- Our Content Starts Here -->
<form id="Form1" runat="server">
<input type="hidden" name="__SCROLLPOS" value="" />
<center>
<br>
</center>
</form>

<!-- Our Content Ends Here -->

<!-- Clients Footers are displayed here -->
<fts:footer id=cdl2 runat="Server" />
************************************************** ****************************************

The problem with the above code is that it works fine for only one client.
I don't want to create the above page for each client. I would have
travacHeaders.ascx for one client, staffersHeaders.ascx for another client,
etc.

Originally, I tried to set up a control to call different include files:

************************************************** *****************************************
<Script runat="server">
Public ClientName As String = "<!-- #include file " & "=
...\includes\travacHeaders.inc -->"

</Script>

<%=ClientName%>
************************************************** *****************************************

One of the problem is that ASP, won't let me set the string to the incude
statement (and you say this won't work anyway).

How do I set this up to call different controls (or include files)?

Thanks,

Tom


"tshad" wrote:
"WebMatrix" <We*******@discussions.microsoft.com> wrote in message
news:9A**********************************@microsof t.com...
> What in the world are you trying to do?
> It looks like you want to add an include file in your page. Which, I
> think,
> is still allowed in
> ASP.NET for backward compatibility. But that's the only reason why it's
> there, you should not be using in ASP.NET.
>
> If you want just to have include file in your page just add
> <!-- #include file ="...\includes\StaffingHeaders.inc"> OUTSIDE server
> script.
>
> This line will be Parsed by ASP and hopefully .inc file will be
> executed.
> But Response.Write which you were doing in your examples will simply
> send
> that string to the browser.
>
> My advise don't use includes in .NET, since it's really old 'classic'
> asp
> feature. Instead adopt OO programming approach.

Actually, that is what I am in the midst of doing now.

My question is why would the parser give me an error on setting up the
string?

If it is in quotes, why would it not accept it?

Isn't the following a valid string?

Public ClientName As String = "<!-- #include file =
....\includes\StaffingHeaders.inc -->"

Also, assuming I can set a variable to the inlude string, outside of the
Script tags, isn't:

<!-- #include file = ...\includes\StaffingHeaders.inc -->

the same as:

<%=ClientName%>.

I was under the impression (and I could be wrong) that <%ClientName%>
would
be replaced with:

<!-- #include file = ...\includes\StaffingHeaders.inc -->

Am I wrong here?

Thanks,

Tom
>
> "tshad" wrote:
>
>> In my User control, I tried to do this:
>> ************************************************** *************************
>> <Script runat="server">
>> Public ClientName As String = "<!-- #include file =
>> ...\includes\StaffingHeaders.inc -->"
>>
>> </Script>
>>
>> <%=ClientName%>
>> ************************************************** **************************
>>
>> This gives me:
>>
>> Parser Error Message: Server includes are not allowed in server
>> script
>> tags.
>>
>>
>> If I try to do it this way:
>> In my User control, I tried to do this:
>> ************************************************** *************************
>> <Script runat="server">
>> Public ClientName As String = "<!-- #" & "include file =
>> ...\includes\StaffingHeaders.inc -->"
>>
>> </Script>
>>
>> <%=ClientName%>
>> ************************************************** **************************
>>
>> It gives me nothing
>>
>> If I do this:
>> ************************************************** *************************
>> <Script runat="server">
>> Public ClientName As String = "!-- #" & "include file =
>> ...\includes\StaffingHeaders.inc -->"
>>
>> </Script>
>>
>> <%=ClientName%>
>> ************************************************** **************************
>> As I would expect, it displays:
>>
>> "!-- #include file = ..\includes\StaffingHeaders.inc -->
>>
>> But as soon as I add the "<", I get the error.
>>
>> This should just be a string, why isn't it?
>>
>> Tom
>>
>>
>>


Nov 18 '05 #6
"WebMatrix" <We*******@discussions.microsoft.com> wrote in message
news:E3**********************************@microsof t.com...
So you are using User Control (.ascx file). Why don't you program your
control to render different content based on the client logged into your
site? For example place image control where company logo should go, and
store
image name + path for each client in AppSettings section of web.config
file
like that:
<add key="Client1" value = "~/images/Client1Logo.gif" />
<add key="Client2" value = "~/images/Client2Logo.gif" />

In your Control you can retrieve logo path by the client name from a
webconfig file and set ImageUrl property of your logo image control
Control
like this:

imgLogo.ImageURL =
Page.resolveURL(System.Configuration.Configuration Settings.AppSettings().Item(ClientName))

Similar techniques can be applied for other dynamic elements of your
control.
That is what I was looking for. I just need to look at this closer to
understand what you are doing.
but I will forgo the inability to set a string to the include statement - which makes no sense at all


No it makes perfect sense. Think about it. What would happen if you did
this:
Response.Write("<!--#include file=""somefile.inc"" -->")
????


You're right. I never noticed the quotes before. Brain fade.

Thanks,

Tom.
"tshad" wrote:
"WebMatrix" <We*******@discussions.microsoft.com> wrote in message
news:B9**********************************@microsof t.com...
> You are missing 2 points:
> 1. Include file is a legacy asp feature, the replacement for includes
> in
> .NET world are things like server-side user controls, and plain .NET
> Claasses.
>
> 2. If you absolutely must use includes then try to understand how web
> server
> parses web pages.
> Everything outside Server Script will be parsed as HTML and served to
> the
> browser. So having
> <%=ClientName%> will simply render whatever value that variable holds.
> However having this text outside server side tags
> <!-- #include file =" ....\includes\StaffingHeaders.inc" --> tells
> parser
> that this is an include file that needs to be executed.
>
> From what I am seeing, you're trying to execute certain piece of code
> dynamically. I think you'll be better off investigating .NET features
> that
> could accomplish your goal. In any case, if you provide more details on
> what
> you're trying to accomplish perhaps someone could steer you to the
> right
> direction.
>
>


Actually, I have 2 problems (but I will forgo the inability to set a
string
to the include statement - which makes no sense at all).

What I am trying to do is create a general aspx page that has all my
normal
processing, except for the top and bottom sections of the pages which are
the company logos, menus etc.

I want to be able go to different companies, have them give me their top
sections (headers) and bottom sections (footers). I would then include
them
like so:

************************************************** ****************************************
<%@ Register TagPrefix="fts" TAgName="header"
src="..\includes\travacHeaders.ascx" %>
<%@ Register TagPrefix="fts" TAgName="footer"
src="..\includes\travacFooters.ascx" %>
<%@ Page Language="VB" trace="false" debug="true" AutoEventWireup="true"
ContentType="text/html" ResponseEncoding="iso-8859-1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<script runat="server">
sub Page_load(s as object,e as eventargs)
end sub
</script>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Home Page</title>

<!-- Clients Headers are displayed here -->
<fts:header id=ctl1 runat="Server" />

<!-- Our Content Starts Here -->
<form id="Form1" runat="server">
<input type="hidden" name="__SCROLLPOS" value="" />
<center>
<br>
</center>
</form>

<!-- Our Content Ends Here -->

<!-- Clients Footers are displayed here -->
<fts:footer id=cdl2 runat="Server" />
************************************************** ****************************************

The problem with the above code is that it works fine for only one
client.
I don't want to create the above page for each client. I would have
travacHeaders.ascx for one client, staffersHeaders.ascx for another
client,
etc.

Originally, I tried to set up a control to call different include files:

************************************************** *****************************************
<Script runat="server">
Public ClientName As String = "<!-- #include file " & "=
...\includes\travacHeaders.inc -->"

</Script>

<%=ClientName%>
************************************************** *****************************************

One of the problem is that ASP, won't let me set the string to the incude
statement (and you say this won't work anyway).

How do I set this up to call different controls (or include files)?

Thanks,

Tom
>
>
> "tshad" wrote:
>
>> "WebMatrix" <We*******@discussions.microsoft.com> wrote in message
>> news:9A**********************************@microsof t.com...
>> > What in the world are you trying to do?
>> > It looks like you want to add an include file in your page. Which, I
>> > think,
>> > is still allowed in
>> > ASP.NET for backward compatibility. But that's the only reason why
>> > it's
>> > there, you should not be using in ASP.NET.
>> >
>> > If you want just to have include file in your page just add
>> > <!-- #include file ="...\includes\StaffingHeaders.inc"> OUTSIDE
>> > server
>> > script.
>> >
>> > This line will be Parsed by ASP and hopefully .inc file will be
>> > executed.
>> > But Response.Write which you were doing in your examples will simply
>> > send
>> > that string to the browser.
>> >
>> > My advise don't use includes in .NET, since it's really old
>> > 'classic'
>> > asp
>> > feature. Instead adopt OO programming approach.
>>
>> Actually, that is what I am in the midst of doing now.
>>
>> My question is why would the parser give me an error on setting up the
>> string?
>>
>> If it is in quotes, why would it not accept it?
>>
>> Isn't the following a valid string?
>>
>> Public ClientName As String = "<!-- #include file =
>> ....\includes\StaffingHeaders.inc -->"
>>
>> Also, assuming I can set a variable to the inlude string, outside of
>> the
>> Script tags, isn't:
>>
>> <!-- #include file = ...\includes\StaffingHeaders.inc -->
>>
>> the same as:
>>
>> <%=ClientName%>.
>>
>> I was under the impression (and I could be wrong) that <%ClientName%>
>> would
>> be replaced with:
>>
>> <!-- #include file = ...\includes\StaffingHeaders.inc -->
>>
>> Am I wrong here?
>>
>> Thanks,
>>
>> Tom
>>
>>
>> >
>> > "tshad" wrote:
>> >
>> >> In my User control, I tried to do this:
>> >> ************************************************** *************************
>> >> <Script runat="server">
>> >> Public ClientName As String = "<!-- #include file =
>> >> ...\includes\StaffingHeaders.inc -->"
>> >>
>> >> </Script>
>> >>
>> >> <%=ClientName%>
>> >> ************************************************** **************************
>> >>
>> >> This gives me:
>> >>
>> >> Parser Error Message: Server includes are not allowed in server
>> >> script
>> >> tags.
>> >>
>> >>
>> >> If I try to do it this way:
>> >> In my User control, I tried to do this:
>> >> ************************************************** *************************
>> >> <Script runat="server">
>> >> Public ClientName As String = "<!-- #" & "include file =
>> >> ...\includes\StaffingHeaders.inc -->"
>> >>
>> >> </Script>
>> >>
>> >> <%=ClientName%>
>> >> ************************************************** **************************
>> >>
>> >> It gives me nothing
>> >>
>> >> If I do this:
>> >> ************************************************** *************************
>> >> <Script runat="server">
>> >> Public ClientName As String = "!-- #" & "include file =
>> >> ...\includes\StaffingHeaders.inc -->"
>> >>
>> >> </Script>
>> >>
>> >> <%=ClientName%>
>> >> ************************************************** **************************
>> >> As I would expect, it displays:
>> >>
>> >> "!-- #include file = ..\includes\StaffingHeaders.inc -->
>> >>
>> >> But as soon as I add the "<", I get the error.
>> >>
>> >> This should just be a string, why isn't it?
>> >>
>> >> Tom
>> >>
>> >>
>> >>
>>
>>
>>


Nov 18 '05 #7

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

Similar topics

8
by: Newsnet Customer | last post by:
Hi, Which system header file do I unclude in order to use the new string data type? KJ
6
by: steveneng | last post by:
C++ Primer Plus Programming Exercises 4th Ed - Prate Help I'm trying to refresh myself and I'm stuck on this problem (not homework/school related but for personal advancement). 6: Do...
3
by: Prakash Bande | last post by:
Hi, I have bool operator == (xx* obj, const string st). I have declared it as friend of class xx. I am now able to do this: xx ox; string st; if (&ox == st) { } But, when I have a vector<xx*>...
18
by: JKop | last post by:
Can some-one please point me to a nice site that gives an exhaustive list of all the memberfunctions, membervariables, operators, etc. of the std::string class, along with an informative...
0
by: vicky | last post by:
Hello Experts, Trying to run sample Postgrel's ECPG(Embedded SQL)programs on RHL 9.0. Im unable to connect to PostgreSQL database (sirishadb) when I run the program .... # su postgres...
2
by: Michael | last post by:
Running DB2 v7 UDB ("DB2 v7.1.0.93", "n031208" and "WR21333") on Windows XP, I am unable to find out why the "Build for Debug" option within Stored Procedure Builder is not enabled on Java stored...
7
by: priyanka | last post by:
Hi there, I had a question. Is there any way of testing a string value in a switch statement. I have about 50 string values that can be in a string variable. I tried cheking them with the if...
24
by: biganthony via AccessMonster.com | last post by:
Hi, I have the following code to select a folder and then delete it. I keep getting a Path/File error on the line that deletes the actual folder. The line before that line deletes the files in...
5
by: erictheone | last post by:
so here is my code. My getlines for the strings keyword and phrase at lines 44 and 79 respectively don't work. Please help!!! #include <cstdlib> #include <string> #include <iostream> #include...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

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.