having trouble reading header values in classic ASP

前端 未结 3 1339

This is all internal servers and software, so I\'m very limited on my options, but this is where I\'m at. This is already a band-aid to a workaround but I have no choice, s

3条回答
  •  梦毁少年i
    2021-01-05 01:51

    I found my answer.

    When I ran this loop

    <%
    for each x in Request.ServerVariables
      response.write("" & x & ": " & Request.ServerVariables(x) & "

    ") next %>

    it would return a list of all the names that were in the header and their values. The custom value I was looking for would show as name "HTTP_CUSTOM_ID" and I could see it, with it's value in the ALL_HTTP and ALL_RAW, but when I tried to pull that specific value, it would return an empty string. The solution I stumbled on (by talking to someone else here at work who had gone through a similar situation with the same service I was trying to accommodate is to use:

    <%=Request.ServerVariables("HEADER_CUSTOM_ID")%>
    

    When viewing the full header, nothing led me to use the HEADER prefix instead of the HTTP, in fact, it led me opposite. And I never found any mention of this anywhere searching online either. So I'm posting my own answer to my question here so it is on the web.

提交回复
热议问题