Reputation: 7625
I'm trying to make use of constants declared in one ASP file in another file. Here's a basic code overview of what I am trying to accomplish:
FileA.asp
Const tr__first_name = "First Name"
Const tr__last_name = "Last Name"
Const tr__english = "English"
FileB.asp
Server.Execute "FileA.asp"
Response.Write Eval("tr__first_name")
What should happen is that when I run FileB.asp it should print out "First Name" for the Response.Write
statement. If I declare const tr__first_name
in FileB.asp resulting in the following code...
Server.Execute "FileA.asp"
Const tr__first_name = "First Name"
Response.Write Eval("tr__first_name")
Then FileB.asp will print out "First Name" as expected. Any thoughts as to why my first approach won't work?
Upvotes: 1
Views: 2032
Reputation: 4163
The issue is that Server.Execute only runs FileA.asp as a standalone page within FileB.asp. In other words, it's not like a programming language making a function call--it is simply running the separate page outside the context of the first page, but displaying the results of the separate page inside the first page.
Do this instead:
<!-- #include file="FileA.asp" -->
Upvotes: 3