Invalid URL form or fully-qualified absolute URL was used. Use relative URLs

Discussion in 'ASP General' started by Rudi Ahlers, Apr 10, 2004.

  1. Rudi Ahlers

    Rudi Ahlers Guest

    Please help, I have tried all possible routes.

    I have a table with a layout, and in one of the cells, I have :
    <%=server.Execute(page)%>

    The code that gives me this problem is:

    newslink = request.QueryString("n")
    IDno = request.QueryString("ID")


    if newslink <> "" then
    page = "news/" & newslink & ".asp"
    If objFSO.FileExists("/news/" & page) = false Then
    page = "news/news.asp"
    End If
    if IDno <> "" then
    page = page & "?ID=" & IDno
    end if
    else
    page = "home.asp"
    end if


    Now, when I type the following URL in,
    http://localhost/newhp/index.asp?n=news, then it works fine
    If, however I type in http://localhost/newhp/index.asp?n=news&ID=71, I get
    the above error.

    all the news stuff is in a seperate folder, but that shouldn't be a problem.
    Please help?
    --

    Kind Regards
    Rudi Ahlers
    +27 (82) 926 1689

    Greater love has no one than this, that he lay down his life for his friends
    (John 15:13).
     
    Rudi Ahlers, Apr 10, 2004
    #1
    1. Advertising

  2. Rudi Ahlers

    Guest

    On Sat, 10 Apr 2004 15:30:36 +0200, "Rudi Ahlers"
    <SP4M_Rudi@SP4M_Bonzai.org.za_SP4M> wrote:

    I think The "page" variable needs to be a string that is like
    "/yourvirtualdirectory/nameofpage.asp" ... a "relative" url that is
    under your root web directory...

    currently it thinks you're trying to use a "fully qualified" url that
    could be in another domain or something...

    >Please help, I have tried all possible routes.
    >
    >I have a table with a layout, and in one of the cells, I have :
    ><%=server.Execute(page)%>
    >
    >The code that gives me this problem is:
    >
    >newslink = request.QueryString("n")
    >IDno = request.QueryString("ID")
    >
    >
    >if newslink <> "" then
    > page = "news/" & newslink & ".asp"
    > If objFSO.FileExists("/news/" & page) = false Then
    > page = "news/news.asp"
    > End If
    > if IDno <> "" then
    > page = page & "?ID=" & IDno
    > end if
    >else
    > page = "home.asp"
    >end if
    >
    >
    >Now, when I type the following URL in,
    >http://localhost/newhp/index.asp?n=news, then it works fine
    >If, however I type in http://localhost/newhp/index.asp?n=news&ID=71, I get
    >the above error.
    >
    >all the news stuff is in a seperate folder, but that shouldn't be a problem.
    >Please help?
    >--
    >
    >Kind Regards
    >Rudi Ahlers
    >+27 (82) 926 1689
    >
    >Greater love has no one than this, that he lay down his life for his friends
    >(John 15:13).
    >
    >
     
    , Apr 10, 2004
    #2
    1. Advertising

  3. Rudi Ahlers

    Rudi Ahlers Guest

    Not quite, server.execute doesn't work with querystrings.........
    Like I said, I tried all possible options, adding a "/" to it, having the
    whole path, etc.
    See, when it's just index.asp?n=news, then it works, but the moment I add
    something to it, like index.asp?n=news&ID=71, then it bombs out

    Check this URL: http://www.aspfaq.com/show.asp?id=2030

    What a bummer. I was hoping though somebody have a different solution?

    --

    Kind Regards
    Rudi Ahlers
    +27 (82) 926 1689

    Greater love has no one than this, that he lay down his life for his friends
    (John 15:13).
    <> wrote in message
    news:...
    On Sat, 10 Apr 2004 15:30:36 +0200, "Rudi Ahlers"
    <SP4M_Rudi@SP4M_Bonzai.org.za_SP4M> wrote:

    I think The "page" variable needs to be a string that is like
    "/yourvirtualdirectory/nameofpage.asp" ... a "relative" url that is
    under your root web directory...

    currently it thinks you're trying to use a "fully qualified" url that
    could be in another domain or something...

    >Please help, I have tried all possible routes.
    >
    >I have a table with a layout, and in one of the cells, I have :
    ><%=server.Execute(page)%>
    >
    >The code that gives me this problem is:
    >
    >newslink = request.QueryString("n")
    >IDno = request.QueryString("ID")
    >
    >
    >if newslink <> "" then
    > page = "news/" & newslink & ".asp"
    > If objFSO.FileExists("/news/" & page) = false Then
    > page = "news/news.asp"
    > End If
    > if IDno <> "" then
    > page = page & "?ID=" & IDno
    > end if
    >else
    > page = "home.asp"
    >end if
    >
    >
    >Now, when I type the following URL in,
    >http://localhost/newhp/index.asp?n=news, then it works fine
    >If, however I type in http://localhost/newhp/index.asp?n=news&ID=71, I get
    >the above error.
    >
    >all the news stuff is in a seperate folder, but that shouldn't be a

    problem.
    >Please help?
    >--
    >
    >Kind Regards
    >Rudi Ahlers
    >+27 (82) 926 1689
    >
    >Greater love has no one than this, that he lay down his life for his

    friends
    >(John 15:13).
    >
    >
     
    Rudi Ahlers, Apr 10, 2004
    #3
  4. Rudi Ahlers

    Guest

    On Sat, 10 Apr 2004 16:17:08 +0200, "Rudi Ahlers"
    <SP4M_Rudi@SP4M_Bonzai.org.za_SP4M> wrote:

    I didn't see all the text in your post. Yeah, you're right, it
    doesn't work with query strings... I found that out early on...

    What the hell good is this extra asp 3.0 function if it doesn't work
    with a query string... ????

    I guess It's really just a replacement for includes.

    I think "transfer" is supposed to be able to use the variables
    explicitly defined on the calling page? or something?

    Just store the vars in a session. I throw them in a dictionary in
    some of my projects.

    >Not quite, server.execute doesn't work with querystrings.........
    >Like I said, I tried all possible options, adding a "/" to it, having the
    >whole path, etc.
    >See, when it's just index.asp?n=news, then it works, but the moment I add
    >something to it, like index.asp?n=news&ID=71, then it bombs out
    >
    >Check this URL: http://www.aspfaq.com/show.asp?id=2030
    >
    >What a bummer. I was hoping though somebody have a different solution?
    >
    >--
    >
    >Kind Regards
    >Rudi Ahlers
    >+27 (82) 926 1689
    >
    >Greater love has no one than this, that he lay down his life for his friends
    >(John 15:13).
    ><> wrote in message
    >news:...
    >On Sat, 10 Apr 2004 15:30:36 +0200, "Rudi Ahlers"
    ><SP4M_Rudi@SP4M_Bonzai.org.za_SP4M> wrote:
    >
    >I think The "page" variable needs to be a string that is like
    >"/yourvirtualdirectory/nameofpage.asp" ... a "relative" url that is
    >under your root web directory...
    >
    >currently it thinks you're trying to use a "fully qualified" url that
    >could be in another domain or something...
    >
    >>Please help, I have tried all possible routes.
    >>
    >>I have a table with a layout, and in one of the cells, I have :
    >><%=server.Execute(page)%>
    >>
    >>The code that gives me this problem is:
    >>
    >>newslink = request.QueryString("n")
    >>IDno = request.QueryString("ID")
    >>
    >>
    >>if newslink <> "" then
    >> page = "news/" & newslink & ".asp"
    >> If objFSO.FileExists("/news/" & page) = false Then
    >> page = "news/news.asp"
    >> End If
    >> if IDno <> "" then
    >> page = page & "?ID=" & IDno
    >> end if
    >>else
    >> page = "home.asp"
    >>end if
    >>
    >>
    >>Now, when I type the following URL in,
    >>http://localhost/newhp/index.asp?n=news, then it works fine
    >>If, however I type in http://localhost/newhp/index.asp?n=news&ID=71, I get
    >>the above error.
    >>
    >>all the news stuff is in a seperate folder, but that shouldn't be a

    >problem.
    >>Please help?
    >>--
    >>
    >>Kind Regards
    >>Rudi Ahlers
    >>+27 (82) 926 1689
    >>
    >>Greater love has no one than this, that he lay down his life for his

    >friends
    >>(John 15:13).
    >>
    >>

    >
    >
     
    , Apr 10, 2004
    #4
  5. Rudi Ahlers

    Guest

    On Sat, 10 Apr 2004 15:43:06 +0100, "Andrew Urquhart"
    <> wrote:

    Yup. It does work. I gave up on that method... now it's fresh as a
    daisy.

    >Rudi Ahlers wrote:
    >> Not quite, server.execute doesn't work with querystrings.........
    >> Like I said, I tried all possible options, adding a "/" to it,
    >> having the whole path, etc.
    >> See, when it's just index.asp?n=news, then it works, but the moment I
    >> add something to it, like index.asp?n=news&ID=71, then it bombs out
    >>
    >> Check this URL: http://www.aspfaq.com/show.asp?id=2030
    >>
    >> What a bummer. I was hoping though somebody have a different solution?

    >
    >The script executed via Server.Execute can still read the *original*
    >querystring, just not a querystring on the script name parameter in the
    >Server.Execute method.
    >
    >From a quick look you seem to be passing some of the same data to the
    >Server.Execute page that was on the querystring on the calling page, so
    >in /news/news.asp just go ahead and pull "ID" from the querystring
    >collection.
    >--
    >Andrew Urquhart
    >- Contact: www.andrewu.co.uk/contact/
    >- Employ me: Front/middle tier ASP developer with WAI & web standards
    >
    >
     
    , Apr 10, 2004
    #5
  6. Thanks Andrew, I've updated the article with this important workaround.
    http://www.aspfaq.com/2030

    --
    Aaron Bertrand
    SQL Server MVP
    http://www.aspfaq.com/





    "Andrew Urquhart" <> wrote in message
    news:4JTdc.402$...
    > Rudi Ahlers wrote:
    >> Not quite, server.execute doesn't work with querystrings.........
    >> Like I said, I tried all possible options, adding a "/" to it,
    >> having the whole path, etc.
    >> See, when it's just index.asp?n=news, then it works, but the moment I
    >> add something to it, like index.asp?n=news&ID=71, then it bombs out
    >>
    >> Check this URL: http://www.aspfaq.com/show.asp?id=2030
    >>
    >> What a bummer. I was hoping though somebody have a different solution?

    >
    > The script executed via Server.Execute can still read the *original*
    > querystring, just not a querystring on the script name parameter in the
    > Server.Execute method.
    >
    > From a quick look you seem to be passing some of the same data to the
    > Server.Execute page that was on the querystring on the calling page, so
    > in /news/news.asp just go ahead and pull "ID" from the querystring
    > collection.
    > --
    > Andrew Urquhart
    > - Contact: www.andrewu.co.uk/contact/
    > - Employ me: Front/middle tier ASP developer with WAI & web standards
    >
    >
     
    Aaron Bertrand [MVP], Apr 10, 2004
    #6
  7. Rudi Ahlers

    Jeff Cochran Guest

    On Sat, 10 Apr 2004 15:30:36 +0200, "Rudi Ahlers"
    <SP4M_Rudi@SP4M_Bonzai.org.za_SP4M> wrote:

    >Please help, I have tried all possible routes.
    >
    >I have a table with a layout, and in one of the cells, I have :
    ><%=server.Execute(page)%>
    >
    >The code that gives me this problem is:
    >
    >newslink = request.QueryString("n")
    >IDno = request.QueryString("ID")
    >
    >
    >if newslink <> "" then
    > page = "news/" & newslink & ".asp"
    > If objFSO.FileExists("/news/" & page) = false Then
    > page = "news/news.asp"
    > End If
    > if IDno <> "" then
    > page = page & "?ID=" & IDno
    > end if
    >else
    > page = "home.asp"
    >end if
    >
    >
    >Now, when I type the following URL in,
    >http://localhost/newhp/index.asp?n=news, then it works fine
    >If, however I type in http://localhost/newhp/index.asp?n=news&ID=71, I get
    >the above error.
    >
    >all the news stuff is in a seperate folder, but that shouldn't be a problem.
    >Please help?


    Use a Response.Write to print the variables and the resulting URL to
    ensure you're getting what you expect. If need be, paste that result
    into your browser and see what is returned from a direct request.

    Jeff
     
    Jeff Cochran, Apr 10, 2004
    #7
  8. Rudi Ahlers

    Rudi Ahlers Guest

    I dunno why, but this works:

    if newslink <> "" then
    page = "news/" & newslink & ".asp"
    If objFSO.FileExists("/news/" & page) = false Then
    page = "news/news.asp"
    End If
    else
    page = "home.asp"
    end if

    My logic told me that I would need to give the URL the ID string, since this
    wasn't really part of the original querystring.

    This is the URL I use:
    http://hobbit/newhp/index.asp?n=news&ID=60, and like I said, it works. when
    I do a response.write, it displays the following:
    news/news.asp - i.e. without the rest of it. This this is the page variable
    which I run as follows:
    server.execute(page)

    I can't explain, cause my logic tells me that if the page variable doesn't
    have the "ID=60" string, it shouldn't display it, yet it does.

    --

    Kind Regards
    Rudi Ahlers
    +27 (82) 926 1689

    Greater love has no one than this, that he lay down his life for his friends
    (John 15:13).
    "Jeff Cochran" <> wrote in message
    news:...
    On Sat, 10 Apr 2004 15:30:36 +0200, "Rudi Ahlers"
    <SP4M_Rudi@SP4M_Bonzai.org.za_SP4M> wrote:

    >Please help, I have tried all possible routes.
    >
    >I have a table with a layout, and in one of the cells, I have :
    ><%=server.Execute(page)%>
    >
    >The code that gives me this problem is:
    >
    >newslink = request.QueryString("n")
    >IDno = request.QueryString("ID")
    >
    >
    >if newslink <> "" then
    > page = "news/" & newslink & ".asp"
    > If objFSO.FileExists("/news/" & page) = false Then
    > page = "news/news.asp"
    > End If
    > if IDno <> "" then
    > page = page & "?ID=" & IDno
    > end if
    >else
    > page = "home.asp"
    >end if
    >
    >
    >Now, when I type the following URL in,
    >http://localhost/newhp/index.asp?n=news, then it works fine
    >If, however I type in http://localhost/newhp/index.asp?n=news&ID=71, I get
    >the above error.
    >
    >all the news stuff is in a seperate folder, but that shouldn't be a

    problem.
    >Please help?


    Use a Response.Write to print the variables and the resulting URL to
    ensure you're getting what you expect. If need be, paste that result
    into your browser and see what is returned from a direct request.

    Jeff
     
    Rudi Ahlers, Apr 10, 2004
    #8
  9. Rudi Ahlers

    Jeff Cochran Guest

    On Sat, 10 Apr 2004 19:16:30 +0200, "Rudi Ahlers"
    <SP4M_Rudi@SP4M_Bonzai.org.za_SP4M> wrote:

    >I dunno why, but this works:
    >
    >if newslink <> "" then
    > page = "news/" & newslink & ".asp"
    > If objFSO.FileExists("/news/" & page) = false Then
    > page = "news/news.asp"
    > End If
    >else
    > page = "home.asp"
    >end if
    >
    >My logic told me that I would need to give the URL the ID string, since this
    >wasn't really part of the original querystring.
    >
    >This is the URL I use:
    >http://hobbit/newhp/index.asp?n=news&ID=60, and like I said, it works. when
    >I do a response.write, it displays the following:
    >news/news.asp - i.e. without the rest of it. This this is the page variable
    >which I run as follows:
    >server.execute(page)
    >
    >I can't explain, cause my logic tells me that if the page variable doesn't
    >have the "ID=60" string, it shouldn't display it, yet it does.


    I think Andrew hit it correctly, you're doing a Server.Execute and
    trying to use a query string. He posted a work-around, but you might
    skip the Server.Execute and just pass the query on the URL with a
    redirect.

    Jeff
     
    Jeff Cochran, Apr 10, 2004
    #9
  10. > Actually I'm surprised to see that querystrings not working on
    > Server.Execute paths is classed as a bug.


    Well, to me, it is. It seems like something that COULD be supported.

    > AFAIK all CGI/state/environment data available to the calling page is
    > available in the Server.Execute'd page, not just the ServerVariables,
    > e.g. form collections, cookies, etc.


    Which is fine, if the calling page was, itself, called with the desired
    parameters. But much like the dynamic #include paradigm, there will always
    be the desire of a portion of users to call a page with conditional
    querystrings that are derived in the calling page, not before.

    A
     
    Aaron Bertrand [MVP], Apr 11, 2004
    #10
  11. Rudi Ahlers

    Lord Merlin Guest

    This is rather true, and I'm sure it would be nice if MS can work on this.

    I can do this in PERL / PHP:

    <?
    if (page == "1")
    include "1.php"
    elseif (page == "2")
    include "2.php")
    elseif(page == "ext")
    include http://www.somedomain.name/file.php
    else
    include "3.php"

    ?>


    This allows for much more flexibility, and it would be nice to have used it
    in ASP as well. I haven't used ASP.NET yet, so I'm not sure if it can be
    done. But in this case the client's hosting is on ASP, so I need to work
    with what I got
    --

    Kind Regards
    Rudi Ahlers
    +27 (82) 926 1689

    Greater love has no one than this, that he lay down his life for his friends
    (John 15:13).
    "Aaron Bertrand [MVP]" <> wrote in message
    news:Oue7Q$...
    > Actually I'm surprised to see that querystrings not working on
    > Server.Execute paths is classed as a bug.


    Well, to me, it is. It seems like something that COULD be supported.

    > AFAIK all CGI/state/environment data available to the calling page is
    > available in the Server.Execute'd page, not just the ServerVariables,
    > e.g. form collections, cookies, etc.


    Which is fine, if the calling page was, itself, called with the desired
    parameters. But much like the dynamic #include paradigm, there will always
    be the desire of a portion of users to call a page with conditional
    querystrings that are derived in the calling page, not before.

    A
     
    Lord Merlin, Apr 11, 2004
    #11
  12. > This allows for much more flexibility, and it would be nice to have used
    > it
    > in ASP as well.


    You can, the problem we're discussing is querystrings. This works fine:

    if something then
    server.execute "page1.asp"
    else
    server.execute "page2.asp"
    end if

    There are also other workarounds for "dynamic includes" ... see
    http://www.aspfaq.com/2042

    --
    Aaron Bertrand
    SQL Server MVP
    http://www.aspfaq.com/
     
    Aaron Bertrand [MVP], Apr 11, 2004
    #12
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jacob Crossley
    Replies:
    0
    Views:
    407
    Jacob Crossley
    Apr 2, 2004
  2. Jacob Crossley
    Replies:
    0
    Views:
    336
    Jacob Crossley
    Apr 6, 2004
  3. JJ

    Fully qualified root URL

    JJ, Oct 31, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    628
    Juan T. Llibre
    Oct 31, 2006
  4. Ramon F Herrera
    Replies:
    5
    Views:
    571
    Esmond Pitt
    Dec 9, 2007
  5. Nathan Sokalski

    Converting Relative URLs into Absolute URLs

    Nathan Sokalski, Aug 11, 2008, in forum: ASP .Net
    Replies:
    1
    Views:
    750
    Sriram Srivatsan
    Aug 12, 2008
Loading...

Share This Page