473,729 Members | 2,331 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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\St affingHeaders.i nc -->"

</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\St affingHeaders.i nc -->"

</Script>

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

It gives me nothing

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

</Script>

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

"!-- #include file = ..\includes\Sta ffingHeaders.in c -->

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 2124
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\St affingHeaders.i nc -->"

</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\St affingHeaders.i nc -->"

</Script>

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

It gives me nothing

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

</Script>

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

"!-- #include file = ..\includes\Sta ffingHeaders.in c -->

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*******@disc ussions.microso ft.com> wrote in message
news:9A******** *************** ***********@mic rosoft.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\S taffingHeaders. inc -->"

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

<!-- #include file = ...\includes\St affingHeaders.i nc -->

the same as:

<%=ClientName%> .

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

<!-- #include file = ...\includes\St affingHeaders.i nc -->

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\St affingHeaders.i nc -->"

</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\St affingHeaders.i nc -->"

</Script>

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

It gives me nothing

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

</Script>

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

"!-- #include file = ..\includes\Sta ffingHeaders.in c -->

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\S taffingHeaders. 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*******@disc ussions.microso ft.com> wrote in message
news:9A******** *************** ***********@mic rosoft.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\S taffingHeaders. inc -->"

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

<!-- #include file = ...\includes\St affingHeaders.i nc -->

the same as:

<%=ClientName%> .

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

<!-- #include file = ...\includes\St affingHeaders.i nc -->

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\St affingHeaders.i nc -->"

</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\St affingHeaders.i nc -->"

</Script>

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

It gives me nothing

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

</Script>

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

"!-- #include file = ..\includes\Sta ffingHeaders.in c -->

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*******@disc ussions.microso ft.com> wrote in message
news:B9******** *************** ***********@mic rosoft.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\S taffingHeaders. 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="..\include s\travacHeaders .ascx" %>
<%@ Register TagPrefix="fts" TAgName="footer "
src="..\include s\travacFooters .ascx" %>
<%@ Page Language="VB" trace="false" debug="true" AutoEventWireup ="true"
ContentType="te xt/html" ResponseEncodin g="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="__SCROLLP OS" 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.a scx 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\tr avacHeaders.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*******@disc ussions.microso ft.com> wrote in message
news:9A******** *************** ***********@mic rosoft.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\S taffingHeaders. inc -->"

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

<!-- #include file = ...\includes\St affingHeaders.i nc -->

the same as:

<%=ClientName%> .

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

<!-- #include file = ...\includes\St affingHeaders.i nc -->

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\St affingHeaders.i nc -->"
>>
>> </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\St affingHeaders.i nc -->"
>>
>> </Script>
>>
>> <%=ClientName %>
>> *************** *************** *************** *************** *************** *
>>
>> It gives me nothing
>>
>> If I do this:
>> *************** *************** *************** *************** ***************
>> <Script runat="server">
>> Public ClientName As String = "!-- #" & "include file =
>> ...\includes\St affingHeaders.i nc -->"
>>
>> </Script>
>>
>> <%=ClientName %>
>> *************** *************** *************** *************** *************** *
>> As I would expect, it displays:
>>
>> "!-- #include file = ..\includes\Sta ffingHeaders.in c -->
>>
>> 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.ImageUR L =
Page.resolveURL (System.Configu ration.Configur ationSettings.A ppSettings().It em(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*******@disc ussions.microso ft.com> wrote in message
news:B9******** *************** ***********@mic rosoft.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\S taffingHeaders. 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="..\include s\travacHeaders .ascx" %>
<%@ Register TagPrefix="fts" TAgName="footer "
src="..\include s\travacFooters .ascx" %>
<%@ Page Language="VB" trace="false" debug="true" AutoEventWireup ="true"
ContentType="te xt/html" ResponseEncodin g="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="__SCROLLP OS" 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.a scx 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\tr avacHeaders.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*******@disc ussions.microso ft.com> wrote in message
news:9A******** *************** ***********@mic rosoft.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\S taffingHeaders. inc -->"

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

<!-- #include file = ...\includes\St affingHeaders.i nc -->

the same as:

<%=ClientName%> .

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

<!-- #include file = ...\includes\St affingHeaders.i nc -->

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\St affingHeaders.i nc -->"
>>
>> </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\St affingHeaders.i nc -->"
>>
>> </Script>
>>
>> <%=ClientName %>
>> *************** *************** *************** *************** *************** *
>>
>> It gives me nothing
>>
>> If I do this:
>> *************** *************** *************** *************** ***************
>> <Script runat="server">
>> Public ClientName As String = "!-- #" & "include file =
>> ...\includes\St affingHeaders.i nc -->"
>>
>> </Script>
>>
>> <%=ClientName %>
>> *************** *************** *************** *************** *************** *
>> As I would expect, it displays:
>>
>> "!-- #include file = ..\includes\Sta ffingHeaders.in c -->
>>
>> 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*******@disc ussions.microso ft.com> wrote in message
news:E3******** *************** ***********@mic rosoft.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.ImageUR L =
Page.resolveURL (System.Configu ration.Configur ationSettings.A ppSettings().It em(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*******@disc ussions.microso ft.com> wrote in message
news:B9******** *************** ***********@mic rosoft.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\S taffingHeaders. 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="..\include s\travacHeaders .ascx" %>
<%@ Register TagPrefix="fts" TAgName="footer "
src="..\include s\travacFooters .ascx" %>
<%@ Page Language="VB" trace="false" debug="true" AutoEventWireup ="true"
ContentType="te xt/html" ResponseEncodin g="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="__SCROLLP OS" 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.a scx 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\tr avacHeaders.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*******@disc ussions.microso ft.com> wrote in message
>> news:9A******** *************** ***********@mic rosoft.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\S taffingHeaders. inc -->"
>>
>> Also, assuming I can set a variable to the inlude string, outside of
>> the
>> Script tags, isn't:
>>
>> <!-- #include file = ...\includes\St affingHeaders.i nc -->
>>
>> the same as:
>>
>> <%=ClientName%> .
>>
>> I was under the impression (and I could be wrong) that <%ClientName% >
>> would
>> be replaced with:
>>
>> <!-- #include file = ...\includes\St affingHeaders.i nc -->
>>
>> 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\St affingHeaders.i nc -->"
>> >>
>> >> </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\St affingHeaders.i nc -->"
>> >>
>> >> </Script>
>> >>
>> >> <%=ClientName %>
>> >> *************** *************** *************** *************** *************** *
>> >>
>> >> It gives me nothing
>> >>
>> >> If I do this:
>> >> *************** *************** *************** *************** ***************
>> >> <Script runat="server">
>> >> Public ClientName As String = "!-- #" & "include file =
>> >> ...\includes\St affingHeaders.i nc -->"
>> >>
>> >> </Script>
>> >>
>> >> <%=ClientName %>
>> >> *************** *************** *************** *************** *************** *
>> >> As I would expect, it displays:
>> >>
>> >> "!-- #include file = ..\includes\Sta ffingHeaders.in c -->
>> >>
>> >> 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
8198
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
2580
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 programming exercise 3, but, instead of declaring an array of three CandyBar structures, use new to allocate the array dynamically. That's the question in case you guys don't ahve the book. I have Exercises 3 done and I can properly use structures. But...
3
4440
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*> and use stl find string xyz;
18
2424
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 description of how each works. I've been trying Google for the last 20 minutes but can't get anything decent. Thanks.
0
2286
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 (enter)
2
3148
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 procedures. It is enabled for SQL stored procedures. It is possible to "Build" and "Run" the Java SPs, it just isn't possible to click on the "Build for Debug" option. Thanks for any help in advance. Michael
7
22129
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 else statements but it looked pretty ugly and the string values to be tested is still increasing. The switch statement seems to be a better choice then the if else statement. But it seems that the switch statement accepts integer values as the test...
24
7557
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 the folder but I get the error message when the procedure attempts to delete the folder selected in the BrowseforFolderbyPath function. How can I get it to delete the folder that the user has selected in the Browse for Folder dialog?
5
3624
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 <fstream> using namespace std; string removeAllWhite( string eric) {
0
8917
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8761
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9142
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8148
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6722
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4795
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3238
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2680
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.