Get ready for BLACK FRIDAY shopping starting in

Forums

This topic is locked

Getting Page URL

Posted 12 Aug 2002 07:17:56
1
has voted
12 Aug 2002 07:17:56 aegis kleais posted:
Ok, this seems simple but the answer eludes me.

How do you get the full URL of the current page?

I can't use Request.ServerVariables("SCRIPT_NAME" cause that truncates variables appended to the URL (I need those)

I can't use Request.ServerVariables("HTTP_REFERER" on the next page because of the way that my system works (described below)

What I want to do is to goto "previous page" after a record edit is done. On my viewing page, you can use a dropdown list and 2 buttons to change the url to page.asp?sort=SORTFIELD&order=ORDER But when you click on a button that takes you to the edit page, and submit that edit, the ASP page reloads itself and then executes the edit command (this reloading of the page makes HTTP_REFERER now the edit page, which I don't want)

I've tried lil tricks like

if (x="" then)
' this is the first time they went to the edit page, so set the referer
Session("docReferer" = Request.ServerVariables("HTTP_REFERER"
x = "1"
end if

So that hopefully when it reloads the page, x is now 1 and Session("docReferer" is now NOT set to the previous page (which would have been the edit page)

And then I just changed the code where it usually uses MM_editRedirectUrl to say something like:

if (Session("docReferer" <> "" then
Response.Redirect(Session("docReferer")
end if

But alas, this is not working. So now that you know what I'm trying to do, got any ideas? It would be a nice feature for DWUD4 to have a "Goto Previous Page if Exists" on the EDIT, UPDATE and INSERT behaviors. They do so on the LOGIN behavior..... oh well.

Aegis Kleais
New Media Web Developer
(DWMX : IIS5.1 : SQL2K : WXP : ASP[VB/JS])

Replies

Replied 12 Aug 2002 18:37:54
12 Aug 2002 18:37:54 Dave Clarke replied:
May have got wrong end of stick but can't you just use the "After Updating Go To" in the UD update behaviour?
Replied 12 Aug 2002 20:13:24
12 Aug 2002 20:13:24 aegis kleais replied:
You can't, because you can't supply the variables in the URL statically.

Ie, I can't tell it "goto page.asp?order=NAME&sort=ASC if they came from page.asp?order=TITLE&sort=DESC

Otherwords, I can't hardcode it. So I need to find a way that "before they goto the edit/insert/delete page, I can set the viewing page (which has the variables and values in the URL) and place it into a session variable.

Then I can just use:

Response.Redirect(Session("docReferer") and it should have the proper location. But that doesn't seem to be the case.

Aegis Kleais
New Media Web Developer
(DWMX : IIS5.1 : SQL2K : WXP : ASP[VB/JS])
Replied 13 Aug 2002 02:37:07
13 Aug 2002 02:37:07 Dave Clarke replied:
right, got you now, sounds like your way should work, but apparently not.

Just looked it up in a book and it gives this in a list of server variables

<b>URL = URL without the domain name</b>, so i presume you use

Request.ServerVariables("URL"

maybe you can then put this in your Session("docReferer".

Also, in the example it gives it doesn't use quotes round the name. i.e

Request.ServerVariables(URL), don't know if that makes a diff to HTTP_REFERER that you were trying to use.

hope that helps


Edited by - Davecl on 13 Aug 2002 02:42:04
Replied 13 Aug 2002 07:09:46
13 Aug 2002 07:09:46 aegis kleais replied:
Placing Request.ServerVariables("URL" into the Session("docreferer" will only put the base page (page.asp) in without the variables I need. Also, I'm pretty sure that they state Request.ServerVariables(URL) and assume that URL is a variable that contains a valid FQDN

I'm super stumped as to why the:

if (x="" then
Session("docreferer" = Request.ServerVariables("HTTP_REFERER"
x="1"
end if

doesn't work right... I mean, the second time the page submits......hmmm.....when the page submits again, x isn't set...let me make that a session value and see what happens.

Aegis Kleais
New Media Web Developer
(DWMX : IIS5.1 : SQL2K : WXP : ASP[VB/JS])
Replied 13 Aug 2002 16:16:48
13 Aug 2002 16:16:48 Brent Colflesh replied:
Dear Aegiskleais,
From www.aspalliance.com/chrisg/default.asp?article=27



function thisScript() thisScript=request.servervariables("SCRIPT_NAME" & "?" & request.ServerVariables("QUERY_STRING"end function

Regards,
Brent

Replied 13 Aug 2002 16:19:54
13 Aug 2002 16:19:54 Dave Clarke replied:
Bet me to it bcolflesh, i was just trying out
request.ServerVariables("QUERY_STRING"
when up you popped <img src=../images/dmxzone/forum/icon_smile_big.gif border=0 align=middle>
Replied 14 Aug 2002 03:52:29
14 Aug 2002 03:52:29 aegis kleais replied:
I found out what the problem was

I was using a variable to check whether i'd be setting the information to the session value or not. But i forgot that when the page reloads, variables are destroyed. So instead, I used a Session, and boom, it's working fine now.

Stiil, isn't it odd how there's no variable for full page URL? Thanks anyways guys!

Aegis Kleais
New Media Web Developer
(DWMX : IIS5.1 : SQL2K : WXP : ASP[VB/JS])
Replied 19 Oct 2006 12:00:26
19 Oct 2006 12:00:26 Ciccio Piccio replied:
To get full page url:

FullURL=""&Request.ServerVariables("HTTP_HOST"&Request.ServerVariables("script_name"&"?"& Request.Querystring

<img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

bye

Reply to this topic