Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Question re:global variables

Status
Not open for further replies.

BeckahC

Programmer
Oct 3, 2001
355
US
I posted this in the ASP forum as well, but since this is in VB Script, I thought I might find some help here as well:

I'm not quite sure I'm going to word this question correctly, so please bear with me.

I have an application which has an ASP front end and a SQL Server 7 Back-end. I am trying to set up controlled Development, QA, and Production environments for it. The problem came about when we realized that in order to be able to maintain the 3 servers the pages that have a small amount hard coded into them would have to be changed, to try to detect what server the page is running on, that way the page would not need to be changed every time it is copied from Dev to QA and again when copied from QA to Prod. I have a global.asa page that points to a globals.asp page. On the Globals.asp page is a BaseURL that all of the functions point to. This has the server name hardcoded into it.

We tried to change it to use:

<SCRIPT LANGUAGE=&quot;VBScript&quot; >
BaseURL = &quot; & request.servervariables(&quot;Server_Name&quot;) & &quot;/directorynamehere/&quot;
</SCRIPT>

but the pages keep coming up looking ok, but loaded with errors re: the request.

I was wondering if there is a way to do this, or if I am destined to hard code these pages manually everytime a change needs to be made until I have a chance to rewrite the whole front end app.

This is what is was before changing it, when it was working fine:

<SCRIPT LANGUAGE=&quot;VBScript&quot; >
BaseURL = &quot;</SCRIPT>

I'm not very advanced at ASP, but am learning as much as I can, when I can. All suggestions are always welcome.

Thank you in advance! :) BeckahC
[noevil]
 
Try it this way

<%
BaseURL = &quot; & Request.ServerVariables(&quot;SERVER_NAME&quot;) & &quot;/directorynamehere/&quot;
%>
Have Fun...

Sharky99 >:):O>
 
Sorry i forgot to put the code tag.
there's no ; after &quot;
Code:
<%
BaseURL = &quot;[URL unfurl="true"]http://&quot;[/URL] & Request.ServerVariables(&quot;SERVER_NAME&quot;) & &quot;/directorynamehere/&quot;
%>

Have Fun...

Sharky99 >:):O>
 
So i presume it's working?

Glad i helped Have Fun...

Sharky99 >:):O>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top