server variables question

Ask a Question related to ASP, Design and Development.

  1. #1

    Default server variables question

    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?




    middletree Guest

  2. Similar Questions and Discussions

    1. Variables question
      I have a musql database on a personal web server which correctly displays the variable I want in flash. However I wish to change my variables now...
    2. Question about url variables
      Does anyone know of a way to grab a complete url, save it in a variable and transfer it to another page. Thanks, Robert
    3. component variables question??
      I would appreciate any help that can be afforded on this... I am gathering the following variables in component definition; btn_action | list |...
    4. QUESTION ON SESSION VARIABLES
      Hi there.... i got a quick one for you guys. i've this session variable that is updated by calling a server method (i set this value when the user...
    5. getenv variables question
      I am trying to write a PHP action into my custom 404 error page that will email me when someone tries to access a bad link. I can get it to work...
  3. #2

    Default Re: server variables question

    What is empty? strServer?

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

    middletree wrote:
    > 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?
    >
    >
    >
    >
    Aaron Guest

  4. #3

    Default Re: server variables question

    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.


    "Aaron" <a@1.net> wrote in message
    news:OfRxR$amDHA.964@TK2MSFTNGP10.phx.gbl...
    > What is empty? strServer?
    >
    > dim strserver
    > strServer = Request.ServerVariables ("server_name")
    > response.write strserver '<-- is this empty?
    >
    > middletree wrote:
    >
    > > 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?
    > >
    > >
    > >
    > >
    >

    middletree Guest

  5. #4

    Default Re: server variables question

    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


    "middletree" <middletree@htomail.com> wrote in message
    news:Oz2ERBbmDHA.1284@TK2MSFTNGP09.phx.gbl...
    > 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.
    >
    >
    > "Aaron" <a@1.net> wrote in message
    > news:OfRx

    Ray at Guest

  6. #5

    Default Re: server variables question

    > Dim asdf4uaiskjdyf74

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


    Aaron Bertrand - MVP Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139