?
Solved

Replace things in request.servervariables("QUERY_STRING")

Posted on 2009-07-13
5
Medium Priority
?
620 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 143

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 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 1920 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 80 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

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
This is pretty cool.  The purpose of this VB Script is to help you document where JAR (Java ARchive) files and specifically java class files are located so that you can address issues seen with a client or that you can speak intelligently with a dev…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

762 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