Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

remove the page.asp after the link

Status
Not open for further replies.

JohannIcon

Programmer
Sep 3, 2002
440
MT
Dear All I have a curiousity. How can I remove the page.asp link from the address bar? For example I have a link called after the user clicks on the menu navigation. How can I get rid of page.asp?f=1 so that only appears? Another thing, will request.querystring still work then?

Thanks for your help and time
 
aye just stick all yer variables in a form and send it that way instead of using the querystring....like

<form action=&quot;page.asp&quot; method=&quot;post&quot;>
<input type=&quot;hidden&quot; value=&quot;1&quot; name=&quot;f&quot;>
<a href=&quot;#&quot; onClick=&quot;submit();&quot;>Click to Submit</a>
</form>

then get it by usin request.form.....

This should work...maybe.

jstar7



-------------------------------------
...what rhymes with month?
 
First of all, page.asp will still be visible in the address bar, and secondly, you cannot always use Request.Form to send variables, cause sometimes you will need to refresh the page.
 
Not sure why forms would cause a problem with refresh, but I may just not be awake yet :)

To get rid of the page name your best bet is going to be to either
a) create a new directory for each and every single file you plan on loading and placing all those files in their indivivdual directories so you can call them all default.asp
or
b) get more complicated and pass an extra variable with every single page in order to keep track of where the client should be going and have one default.asp page that uses a Select Case statement to determine which page to show the user, then uses Server.Execute or Server.Transfer to execute the correct page and display it to the user.

The reasoning behind using default.asp is becuse this is generally the default page the server will try to dish out if it receives a directory request, ie, will cause the folder to try and find which it will then execute.

As far as refreshing goes youu should be fine as it will resubmit the last set of posted values again and should go through the same exact process to load the same exact page.

-Tarwn

[sub]01000111 01101111 01110100 00100000 01000011 01101111 01100110 01100110 01100101 01100101 00111111[/sub]
minilogo.gif alt=tiernok.com
The never-completed website
 
Thanks Tarwin, but I guess your solution is a bit time-consuming! Imagine having about 100asp pages! I thought there was a clearcut solution to this.

Regarding refresh, what I meant was when using the response.redirect(&quot;&quot;) to display the same page, since no submit buttons are used, then the variables cannot be passed. Hope u get my reasoning.
 
Oh, ok. I think Response.Redirect would be something to stay away from in a situation like this anyways. Server.Transfer would probably be a better moveif you needed to redirect because you would keep the form values .They wouild still be accessible because it is a server-side redirection of processing rather than a client-side redirect (Response.Redirect sends a header to the client askinbg them to rediect, which causes the client to send out a new request for the page you want them to redirect to).

-Tarwn

[sub]01000111 01101111 01110100 00100000 01000011 01101111 01100110 01100110 01100101 01100101 00111111[/sub]
minilogo.gif alt=tiernok.com
The never-completed website
 
You can easily keep just the domain in the address bar by using frames.

Have your default page consist of a frameset with one frame taking up 100% of the screen. Then everything else is loaded in that frame and functions as normal.

--James
 
Thanks Tarwin, I have never used Server.Execute or Server.Transfer but I will surely investigate them since my headache is always when I have to redirect content to a page and to pass all the varaibles through a querysting, thanks for this tip! So I guess Server.Transfer operates just like response.redirect but on the server side. Intersting!

As for JamesLean, I do not like using frames, I prefer using tables.

Thanks for all your help
 
Note:

When using Server.Execute(&quot;mypage.asp&quot;), the code contained in &quot;mypage.asp&quot; CANNOT reference any VARIABLES set in the original page, prior to the Execute.

Execute is a great method for providing variable, fixed (or mostly fixed) data to your pages, without the overhead of <!--#INCLUDE--> files.

Your Execute'd pages CAN, however, get the Request.ServerVariables(&quot;QUERY_STRING&quot;), and other stuff from the server.

So, if you have a file &quot;processMyVar&quot; with the following code:
Code:
<%
if myVar = &quot;potato&quot; then
  response.write(&quot;Tuber!&quot;)
elseif myVar = &quot;begonia&quot;
  response.write(&quot;Flower!&quot;)
end if
%>

the following would NOT work:
[code]
<%
dim myVar
myVar = &quot;potato&quot;
Server.Execute(&quot;processMyVar.asp&quot;)
%>

... in this case you'd have to use an INCLUDE, so processMyVar could receive the variables set in your top page.

Wait, there's more:

If your original page was accessed with the following url:

...then your &quot;processMyVar.asp&quot; could access the querystring:
<%
if request.querystring(myVar) = &quot;potato&quot; then
response.write(&quot;Tuber!&quot;)
elseif request.querystring(myVar) = &quot;begonia&quot; then
response.write(&quot;Flower!&quot;)
end if
%>

SessionVariables are also available to Executed code.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top