cukcuk
asked on
Request.ServerVariables error
hi, how to get the page name from the url using Request.ServerVariables?
E.G.:
http://localhost/test/hihi.asp
I want to get the hihi.asp page name.
Is it possible to do that?
Using PATH_INFO & URL doesn't help.
Please advice.
E.G.:
http://localhost/test/hihi.asp
I want to get the hihi.asp page name.
Is it possible to do that?
Using PATH_INFO & URL doesn't help.
Please advice.
ASKER
Hi, AmericanDogma,
Can you show me the trim codings?
I have no idea on how to start.
Thanks.
Can you show me the trim codings?
I have no idea on how to start.
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi, try this:
<%
scriptname = request.servervariables("S CRIPT_NAME ")
For i = 1 to len(scriptname)
If mid(scriptname,i,1) = "/" Then
count = count + 1
End If
Next
For i = 1 to len(scriptname)
If mid(scriptname,i,1) = "/" Then
count2 = count2 + 1
If count2 = count Then
Response.Write mid(scriptname,i+1,len(scr iptname))
End If
End If
Next
%>
Regards,
Wakie.
<%
scriptname = request.servervariables("S
For i = 1 to len(scriptname)
If mid(scriptname,i,1) = "/" Then
count = count + 1
End If
Next
For i = 1 to len(scriptname)
If mid(scriptname,i,1) = "/" Then
count2 = count2 + 1
If count2 = count Then
Response.Write mid(scriptname,i+1,len(scr
End If
End If
Next
%>
Regards,
Wakie.
ASKER
Hi, AmericanDogma,
Can you show me the trim codings?
I have no idea on how to start.
Thanks.
Can you show me the trim codings?
I have no idea on how to start.
Thanks.
ASKER
i'll take a look at it...
to get current page name:
<%
ThePageURL=GetURL()
%>
<script language="JavaScript">
<!--
function GetURL()
{
return location.href
}
//-->
</script>
Enjoy!
MaxOvrdrv2
<%
ThePageURL=GetURL()
%>
<script language="JavaScript">
<!--
function GetURL()
{
return location.href
}
//-->
</script>
Enjoy!
MaxOvrdrv2
oops... typo...
this:
return location.href
should read:
return location.href;
forgot the semi-colon at the end...
MaxOvrdrv2
this:
return location.href
should read:
return location.href;
forgot the semi-colon at the end...
MaxOvrdrv2
and if that doesnt work... try changing this line:
return location.href;
to one of these 2:
return window.location.href;
OR
return this.location.href;
MaxOvrdrv2
return location.href;
to one of these 2:
return window.location.href;
OR
return this.location.href;
MaxOvrdrv2
sorry with the email system down yesterday I never made it back to this question
http://www.4guysfromrolla.com/demos/servervariables.asp
There is nothign to get jsut the name of the actual pag ebut you could do somehtign like Replace(Request.ServerVari
That will remove the /test/
Another option would be to trim everythign before the last / if this suits you needs better let me know and I will write up the code for you using InStr() and Left()