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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

question about globals

Status
Not open for further replies.

BeckahC

Programmer
Oct 3, 2001
355
US
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]
 
Does anyone have any info about this? If you need more info to help, please let me know.

Thanks again! BeckahC
[noevil]
 
have you tried.
Code:
BaseURL=&quot;[URL unfurl="true"]http://&quot;&Request.ServerVariables(&quot;SERVER_NAME&quot;)&&quot;/&quot;&Split(Request.ServerVariables(&quot;PATH_INFO&quot;),&quot;/&quot;)(1)&&quot;/&quot;[/URL]

where are you setting BaseURL?
 
I'm setting the base URL at the top of Globals.asp, which is referred to in Global.asa, as well as nearly every page in the app. I think there is a piece of code that someone came up with that seems to work, I haven't tested it in depth, though:

<SCRIPT LANGUAGE=VBScript runat=Server>
Dim gNetwork, gComputerName
Set gNetwork = CreateObject(&quot;WScript.Network&quot;)
gComputerName = gNetwork.ComputerName
BaseURL = &quot; & gComputerName & &quot;/directorynamehere/&quot;
Set gNetwork = nothing
</SCRIPT>


This is so far not getting any errors, but we'll see on Moday....

Thank you for your help, I'll try your idea next if this doesn't work.:) BeckahC
[noevil]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top