Solved

Replace things in request.servervariables("QUERY_STRING")

Posted on 2009-07-13
5
590 Views
Last Modified: 2012-06-21
I have a link to switch between languages.
So what I need to do is search in request.servervariables("QUERY_STRING") if there is a "&lg=1" or "&lg=2" in string then remove it.
Example:
request.servervariables("QUERY_STRING") = http://www.mysit.com/products.asp?id_product=1&tab=2&lg=1
I need it to return only until http://www.mysit.com/products.asp?id_product=1&tab=2
Please, help!
Thanks in advance!

<%if idioma = 2 then%>

<a href="<%=request.servervariables("URL")%>?<%=request.servervariables("QUERY_STRING")%>&lg=1">LINK to language 1<a>

<%else%>

<a href="<%=request.servervariables("URL")%>?<%=request.servervariables("QUERY_STRING")%>&lg=2">LINK to language 2<a>

<%end if%>

Open in new window

0
Comment
Question by:drix76
  • 2
  • 2
5 Comments
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 24844893
you mean:
<%
Dim qs
qs = request.servervariables("QUERY_STRING")
qs = replace(qs, '&1g=1', '')
qs = replace(qs, '&1g=2', '') 
if idioma = 2 then%>
<a href="<%=request.servervariables("URL")%>?<%=qs%>&lg=1">LINK to language 1<a>
<%else%>
<a href="<%=request.servervariables("URL")%>?<%=qs%>&lg=2">LINK to language 2<a>
<%end if%>

Open in new window

0
 

Author Comment

by:drix76
ID: 24844928
Thank you for your quick answer, but it didn't work... The &lg=1 or 2 is still in qs

<%
Dim qs
qs = request.servervariables("QUERY_STRING")
qs = replace(qs, "&1g=1", "")
qs = replace(qs, "&1g=2", "")
response.write qs
' it results products.asp?id_product=1&tab=2&lg=1 still
%>
0
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 480 total points
ID: 24844937
is that a 1 (one) or l (letter L) ?


qs = replace(qs, "&lg=1", "")

qs = replace(qs, "&lg=2", "") 

Open in new window

0
 
LVL 9

Assisted Solution

by:rg20
rg20 earned 20 total points
ID: 24844945
He code you have above has a "1g". Not "lg". One vs L would not work
0
 

Author Closing Comment

by:drix76
ID: 31603064
Thank you both very much!!!
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Well hello again!  Glad to see you've made it this far without giving up.  In this, the fourth installment of my popular series, I'm going to cover functions and subroutines, what they are, and why they are useful.  Just in case you stumbled onto th…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now