Below is a script I use to strip everything from a url except the actual
page. So for example, "http://www.cnn.com/mypage.asp?article=5&id=20"
becomes "mypage.asp".
I'm looking for a script that will strip any querystring from a url if it
exists, so my result would be "http://www.cnn.com/mypage.asp".
Can someone help me modify my script below to achieve this result? I'm
horrible with string functions.
CODE to Get URL **************
Right(Request.ServerVariables("SCRIPT_NAME"),Len(R equest.ServerVariables("SCRIPT_NAME"))-InStrRev(Request.ServerVariables("SCRIPT_NAME"),"/")) 8 5212
Scott wrote on 03 sep 2006 in microsoft.public.inetserver.asp.general:
"http://www.cnn.com/mypage.asp?article=5&id=20"
I'm looking for a script that will strip any querystring from a url if
it exists, so my result would be "http://www.cnn.com/mypage.asp".
<% 'vbscript
t = "http://www.cnn.com/mypage.asp"
response.write stripFromQmark(t)
%>
<script runat='server' language='jscript'>
function stripFromQmark(x){
return x.replace(/\?.*/,'')
}
</script>
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
"Scott" <sb*****@mileslumber.comwrote in message
news:#M**************@TK2MSFTNGP02.phx.gbl...
Below is a script I use to strip everything from a url except the actual
page. So for example, "http://www.cnn.com/mypage.asp?article=5&id=20"
becomes "mypage.asp".
I'm looking for a script that will strip any querystring from a url if it
exists, so my result would be "http://www.cnn.com/mypage.asp".
Can someone help me modify my script below to achieve this result? I'm
horrible with string functions.
CODE to Get URL **************
Right(Request.ServerVariables("SCRIPT_NAME"),Len(R equest.ServerVariables("SC
RIPT_NAME"))-InStrRev(Request.ServerVariables("SCRIPT_NAME"),"/"))
Dim strRSV
strRSV = Request.ServerVariables("SCRIPT_NAME")
Dim strURL
strURL = Left(strRSV,InStr(strRSV,"?") -1)
Thank you.
"McKirahan" <Ne**@McKirahan.comwrote in message
news:xL******************************@comcast.com. ..
"Scott" <sb*****@mileslumber.comwrote in message
news:#M**************@TK2MSFTNGP02.phx.gbl...
>Below is a script I use to strip everything from a url except the actual page. So for example, "http://www.cnn.com/mypage.asp?article=5&id=20" becomes "mypage.asp".
I'm looking for a script that will strip any querystring from a url if it exists, so my result would be "http://www.cnn.com/mypage.asp".
Can someone help me modify my script below to achieve this result? I'm horrible with string functions.
CODE to Get URL **************
Right(Request.ServerVariables("SCRIPT_NAME"),Len(R equest.ServerVariables("SC
RIPT_NAME"))-InStrRev(Request.ServerVariables("SCRIPT_NAME"),"/"))
Dim strRSV
strRSV = Request.ServerVariables("SCRIPT_NAME")
Dim strURL
strURL = Left(strRSV,InStr(strRSV,"?") -1)
"Scott" <sb*****@mileslumber.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
Below is a script I use to strip everything from a url except the actual
page. So for example, "http://www.cnn.com/mypage.asp?article=5&id=20"
becomes "mypage.asp".
I'm looking for a script that will strip any querystring from a url if it
exists, so my result would be "http://www.cnn.com/mypage.asp".
Can someone help me modify my script below to achieve this result? I'm
horrible with string functions.
CODE to Get URL **************
Right(Request.ServerVariables("SCRIPT_NAME"),Len(R equest.ServerVariables("SC
RIPT_NAME"))-InStrRev(Request.ServerVariables("SCRIPT_NAME"),"/"))
>
The SCRIPT_NAME server variable does not contain query string. Nor does it
contain protocol or host name it only contains the absolute virtual path to
the script.
Scott wrote:
Below is a script I use to strip everything from a url
except the actual page. So for example,
"http://www.cnn.com/mypage.asp?article=5&id=20" becomes
"mypage.asp".
If you intend this for a link, simply use this:
<a href="<%=Request.ServerVariables("URL")%>"... </a>
No need to parse anything.
--
Dave Anderson
Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms.
Dave Anderson wrote on 04 sep 2006 in
microsoft.public.inetserver.asp.general:
Scott wrote:
>Below is a script I use to strip everything from a url except the actual page. So for example, "http://www.cnn.com/mypage.asp?article=5&id=20" becomes "mypage.asp".
If you intend this for a link, simply use this:
<a href="<%=Request.ServerVariables("URL")%>"... </a>
No need to parse anything.
Certainly, but is it useful to link tot the page itself?
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Evertjan. wrote:
Certainly, but is it useful to link tot the page itself?
Yes, especially when the querystring has session-related nonsense in it,
such as the way youtube embeds the search query in subsequent links. Perhaps
I should have written it this way:
<a href="<%=Request.ServerVariables("URL")%>">Permali nk</a>
--
Dave Anderson
Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms.
Dave Anderson wrote on 04 sep 2006 in
microsoft.public.inetserver.asp.general:
Evertjan. wrote:
>Certainly, but is it useful to link tot the page itself?
Yes, especially when the querystring has session-related nonsense in
it, such as the way youtube embeds the search query in subsequent
links. Perhaps I should have written it this way:
<a href="<%=Request.ServerVariables("URL")%>">Permali nk</a>
Yes. I see some sense in an inc file with:
<form
action = '<%=Request.ServerVariables("URL")%>'
method = 'get'
>
....
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: scott |
last post by:
I have a field with datetime values like below LISTING 1. Can someone help
me write code strip the time part so only values like "7/15/2005" will be
left.
Note - We must be able to strip dates...
|
by: Mark Miller |
last post by:
I have a scheduled job that uses different XSL templates to transform XML
and save it to disk. I am having problems with the code below. The problem
shows up on both my development machine (Windows...
|
by: dan.j.weber |
last post by:
I'm using Python 2.3.5 and when I type the following in the interactive
prompt I see that strip() is not working as advertised:
>>>s = 'p p:p'
>>>s.strip(' :')
'p p:p'
Is this just me or...
|
by: Brian Henry |
last post by:
I thought this was useful, its a extender i just wrote for the new .NET menu
strip and status strip to extend the menu items to add a status message so
when a mouse rolls over the item it displays...
|
by: KevinGPO |
last post by:
I am wondering about what's the best and easiest way to strip trailing
whitespace from every single file in a folder, recursively.
I want to write a program/script so that you pass in a folder...
|
by: rtilley |
last post by:
s = ' qazwsx '
# How are these different?
print s.strip()
print str.strip(s)
Do string objects all have the attribute strip()? If so, why is
str.strip() needed? Really, I'm just curious......
|
by: eight02645999 |
last post by:
hi
can someone explain strip() for these :
'example'
when i did this:
'abcd,words.words'
|
by: Colin J. Williams |
last post by:
The Library Reference has
strip( )
Return a copy of the string with the
leading and trailing characters removed.
The chars argument is a string
specifying the set of characters to be
removed....
|
by: Christoph Zwerschke |
last post by:
In Python programs, you will quite frequently find code like the
following for removing a certain prefix from a string:
if url.startswith('http://'):
url = url
Similarly for stripping...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |