Alpha DevCon 2018
Results 1 to 4 of 4

Thread: Trouble with getting the query string

  1. #1
    Member
    Real Name
    Ragnar Midtskogen
    Join Date
    Sep 2006
    Posts
    19

    Default Trouble with getting the query string

    Hello, I am trying to pass a string with the URL for an a5w page and I can't get it to work. Using the Trace.Writeln in the code for the GetUserInfo.a5w page I can confirm that the Request.Referer is: http://localhost/a5host/GetUserInfo.a5w?Type=personal
    But, when I use Trace.Writeln to show Request.Query_String I get nothing.
    The code I use to investigate is:
    dim TmpString as c
    dim QString as c
    TmpString = Request.Referer
    trace.WriteLn("Full URL is: " + TmpString)
    QString = Request.Query_String
    trace.WriteLn("Raw query string is: " + QString)
    What am I doing wrong?
    Any help would be appreciated.
    Ragnar

  2. #2
    Member
    Real Name
    Prabin
    Join Date
    Apr 2008
    Posts
    1

    Default Re: Trouble with getting the query string

    dim QString as C

    QString =Extract_String(Request.Query_String, "Type=","&")
    you need to add "&" at the end of query string

  3. #3
    Moderator Steve Wood's Avatar
    Real Name
    Steve Wood
    Join Date
    Nov 2003
    Location
    Bay Area, California
    Posts
    8,787

    Default Re: Trouble with getting the query string

    trace.writeln is a desktop only function and cannot be used in a web application.

    These are valid:
    QString = Request.Query_String
    session.QString = Request.Query_String

    but the code with trace functions are not going to work.

    The extract_string() method is not required, your QString variable should contain "Type=personal" without that function.

    You can also use save_to_file() function to write the variable contents to a file for viewing.
    Steve Wood
    Join the ALPHA DEVELOPERS NETWORK
    There is no Cloud. It's just someone else's computer.
    Web - Mobile - Hosting - Products - Frameworks - Developer Resources
    AlphaToGo | IADN (100% Alpha Anywhere Websites)

  4. #4
    Alpha Software Employee Lenny Forziati's Avatar
    Real Name
    Lenny Forziati
    Join Date
    Nov 2001
    Location
    Alpha Software
    Posts
    4,640

    Default Re: Trouble with getting the query string

    Request.referer is the page that contained the link or form that generated the current request, so http://localhost/a5host/GetUserInfo.a5w?Type=personal is the last page that was viewed, not this one.

    On the other hand, Request.Query_String refers to this request. "Type=personal" was the query string for the referring page and may or may not have also been the query string for the current request. So the real question is did this request even have query string with it? You can examine request.raw to find out.

    Lenny Forziati
    Vice President, Internet Products and Technical Services
    Alpha Software Corporation

Similar Threads

  1. need some help converting a string
    By gkeramidas in forum Alpha Five Version 7
    Replies: 4
    Last Post: 12-17-2005, 10:11 PM
  2. string conversion ??
    By Newton Thomas in forum Alpha Five Version 5
    Replies: 4
    Last Post: 10-21-2004, 09:58 AM
  3. Simple way to return query key value as a string?
    By csda1 in forum Alpha Five Version 5
    Replies: 2
    Last Post: 07-09-2004, 11:33 AM
  4. Query filter trouble
    By Ronald Anusiewicz in forum Alpha Five Version 5
    Replies: 3
    Last Post: 03-14-2004, 06:11 AM
  5. Trouble with Query
    By Nip Lewis in forum Alpha Five Version 4
    Replies: 2
    Last Post: 04-18-2003, 05:10 AM

Bookmarks

Posting Permissions

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