Print Page | Close Window

show the url in ASP

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: General Discussion
Forum Description: General discussion and chat on any topic.
URL: https://forums.webwiz.net/forum_posts.asp?TID=25809
Printed Date: 29 March 2026 at 2:07pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: show the url in ASP
Posted By: mhanif
Subject: show the url in ASP
Date Posted: 09 June 2008 at 4:14pm
I would like to know how can i show the URL of the current page, like  if i am at default.asp then on top of my page default.asp should be written.   please tell me the code to show the url.
 
Thank you.



Replies:
Posted By: mhanif
Date Posted: 09 June 2008 at 5:26pm
ok guys, i got it.
 
i was looking for this.  Request.ServerVariables("SCRIPT_NAME")
 
Thanks,


Posted By: 123Simples
Date Posted: 09 June 2008 at 5:28pm
Come again? Can you explain what you mean my friend?
Are you meaning the Title bar?


-------------
http://www.123simples.com/" rel="nofollow - Visit 123 Simples Web Design


Posted By: mhanif
Date Posted: 09 June 2008 at 6:36pm
No, actually i wanted to print the file name of the current page.  like if i am visiting the page default.asp then the default.asp should be printed on the page,
 
so i didnt remember the asp code for that, then i found it on google so my problem is solved,
 
i did it like this.
 
<%
filename = Request.ServerVariables("SCRIPT_NAME")
response.write filename
%>
 
it shows the file name of the page you are visiting.... i hope i explained it properly.
 
anyways, Thanks alot for responding.


Posted By: Jono
Date Posted: 09 June 2008 at 8:10pm
I normally create a debug.asp page to server, session and application variables. It may be useful to you:
 
<%
Dim strKey, intLoop
%>
<h2>Application Variables</h2>
<p>This section shows the variables applicable to the application.</p>
<table class="RecordSet">
<thead>
 <tr><th>Application Variable</th><th>Variable Type</th><th>Variable Data</th></tr>
</thead>
<tbody>
<%
intLoop = 0
For Each strKey in Application.Contents
 Response.write "<tr class=""row" & intLoop Mod 2 & """><td>" & strKey & "</td><td>" & VarType(Application.Contents(strKey)) & "</td><td>" & Application.Contents(strKey) & "</td></tr>" & vbNewLine
 intLoop = intLoop + 1
next
%>
</tbody>
</table>
 
<h2>Session Variables</h2>
<p>This section shows the variables applicable to the current user within the application.</p>
<table class="RecordSet">
<thead>
 <tr><th>Session Variable</th><th>Variable Type</th><th>Variable Data</th></tr>
</thead>
<tbody>
<%
intLoop = 0
For Each strKey in Session.Contents
 Response.write "<tr class=""row" & intLoop Mod 2 & """><td>" & strKey & "</td><td>" & VarType(Session.Contents(strKey)) & "</td><td>" & Session.Contents(strKey) & "</td></tr>" & vbNewLine
 intLoop = intLoop + 1
next
%>
</tbody>
</table>
 
<h2>Server Variables</h2>
<p>This section shows the Server Variables that are available to the application.</p>
<table class="RecordSet">
<thead>
 <tr><th>Server Variable</th><th>Variable Type</th><th>Variable Data</th></tr>
</thead>
<tbody>
<%
intLoop = 0
For Each strKey in Request.ServerVariables'.Contents
 Response.write "<tr class=""row" & intLoop Mod 2 & """><td>" & strKey & "</td><td>" & VarType(Request.ServerVariables(strKey)) & "</td><td>" & Request.ServerVariables(strKey) & "</td></tr>" & vbNewLine
 intLoop = intLoop + 1
next
%>
</tbody>
</table>


Posted By: mhanif
Date Posted: 09 June 2008 at 9:19pm
Thanks alot, Smile



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net