server variables question

M

middletree

I have a little snippet of code that looks like this:

strServer = Request.ServerVariables ("server_name")
If strServer = "localhost" then


The purpose of this code is to do one thing when I'm on my development
machine, and another when on production. This is valuabel as it has kept me
from having to change code when uploading from dev to prod.

It was working fine, as recently as two hours ago, and now it doesn't. I do
a response.write and it returns an empty string. I have no idea why, and I
certainly didn't change anything. Anyone have any idea why this could
happen?
 
A

Aaron

What is empty? strServer?

dim strserver
strServer = Request.ServerVariables ("server_name")
response.write strserver '<-- is this empty?
 
M

middletree

Yes, strServer is empty.

Specifically I do
response.write strServer &"test"
response.end

and get:

test


Also, it should be noted that although I show a space just before the
opening parenthesis, there's actually no space in my code. Just a typo here.
 
R

Ray at

Load up a page with this code and look at the results.
<%
Dim asdf4uaiskjdyf74
For each asdf4uaiskjdyf74 in Request.ServerVariables
Response.Write asdf4uaiskjdyf74 & " = " &
Request.ServerVariables(asdf4uaiskjdyf74)
Response.Write "<hr>"
Next
%>

Do you see all the server variable values, and does SERVER_NAME show up
okay?

Ray at home
 
A

Aaron Bertrand - MVP

Dim asdf4uaiskjdyf74

WT_? Do you always make your variable names this cryptic, or only on
Thursdays? :p
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,136
Messages
2,570,795
Members
47,346
Latest member
Jason Calder

Latest Threads

Top