Results 1 to 4 of 4

Thread: Response.Redirect uses only relative references??

Hybrid View

  1. #1
    Join Date
    Nov 2002
    Norwood, MA

    Question Response.Redirect uses only relative references??

    Hi everyone!!

    I've been fighting with a Response.Redirect that doesn't like me using a variable to tell it where to go. Let me make sense: I defined a variable, JustCameFrom to be the HTTP_REFERER and I want to use it after an asp page executes to return to where I came from. However, when I use the syntax: Response.Redirect(JustCameFrom) (I did try several variants to typing it) instead of just shooting me back to the URL that JustCameFrom has stored, it does something like...


    Instead of just http://hseweb/corract/views/open_corracts.asp which is what JustCameFrom contains (I checked that out with a Response.Write).

    Any ideas????? THANKSSSSSS!!!!!!!


  2. #2
    Join Date
    Jan 2003
    Dundee, Scotland
    i looked into this one for you, it looks like it shouldn't be relied upon. Have a look for yourself:

    Her is some quotes from the page:

    What is wrong with Request.ServerVariables("HTTP_REFERER")?

    The situations where this servervariable works include the following methods of a browser loading a URL:

    A straight HTML <a href>
    A form submit (POST or GET) using a submit button or <input type=image>
    A form submit (POST or GET) using JavaScript
    The situations where it doesn't work:
    A link from Favorites
    A click on 'Home' or a Link with a defined URL
    A JavaScript location.href or location.replace()
    A page linked from HierMenus (details)
    Typing the URL directly in the browser
    Launching a clickable URL from an e-mail or Word document
    Using Response.Redirect / Server.Transfer
    Using Response.AddHeader or <meta http-equiv=refresh> to redirect
    Loading the URL with XML (see Article #2173)
    Obviously, this variable cannot be relied upon for many situations.
    As i said have a look at the page, run the example code then find another way of doing what you are trying to do.

    Hope this helps.

  3. #3
    Join Date
    Nov 2002
    Norwood, MA
    Hi Ribeyed,

    Thanks for looking that up for me! I've bookmarked that site, it looks like it has plenty of good stuff. My thing, though, is different from what the page you sent me adresses. I do get the right information from Request.ServerVariables("HTTP_REFERER") into the JustCameFrom variable, but what happens is that I can't get the Response.Redirect to use that info alone, instead of plugging the current path as a prefix.

    I also tried doing this using JavaScript:

    <SCRIPT LANGUAGE="JavaScript">
    <!-- Begin
    redirTime = "5000";
    redirURL = "http://hseweb/index.htm";
    function redirTimer() { self.setTimeout("self.location.href = redirURL;",redirTime); }
    // End -->

    And adding onLoad="redirTimer()" to the body tag. But if I try to replace the full-text url with a Response.Write(JustCameFrom), although the code parses OK (I checked out the source code on the page once it loaded), the script cannot execute. It complains it's missing an element (referring to the line where the function is defined)... but I can't tell what it's missing!!!

    I also tried using Server.Transfer which is recommended at http://www.aspfaq.com/show.asp?id=2217 but that didn't work out either...

    Thanks again for your help, if you have any more input, it would be great!!!!!


  4. #4
    Join Date
    Nov 2002
    Norwood, MA
    In case I left anyone wondering... I solved this by using:

    JustCameFrom = Request.Form("CameFrom")
    Response.Write("<meta http-equiv=""refresh"" content=""1; url=" & JustCameFrom & """>")

    Worked like a charm!!

    Me (all happy all over again!)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center