Max
Max

Reputation: 1

Request.ServerVariables in classic Asp

I have this requirement: I need to save the search word made by a user who has come to my site. The site is made in classic asp. I have tried with: Request.ServerVariables ("HTTP_REFERER") Request.ServerVariables ("ALL_HTTP")

But I don't get the search query (q=) https://www.google.com/search?q=house

How can I get the value of q= ?

Upvotes: -1

Views: 514

Answers (1)

TiK
TiK

Reputation: 149

The following code will give you what you are looking for:

    Response.Write(Split(Split(Request.ServerVariables ("HTTP_REFERER"), "?")(1),"=")(1))

For sure, you will need to adapt it : if you don't have query string, it will fail, and the parameter you are looking for needs to be the first one.

Upvotes: 2

Related Questions