Results 1 to 7 of 7

Thread: ASP RePOSTing

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2001
    Posts
    1,140

    ASP RePOSTing

    My question is, how can an ASP execute a POST to a specified URL in the same manner it can Redirect?

    Why do I ask this (to help clarify if I'm not asking the question well enough)?

    My client's product will POST to a paging provider's web site. It converts spaces in the URI to %20, but does not convert other special characters (double quotes). We've encountered a non-commercial, proprietary, in-house (read: annoying) paging provider that refuses messages that include double quotes.

    I'm trying to write an ASP that will be a simple layer between our product and thier paging host. It will parse the string that would've been sent to thier host and convert double quotes to %22. But it must do a POST to their host.

    I'm afraid that doing a Redirect with the URI as a query string with do a GET.

    So, how can I do a POST?
    Travis, Kung Foo Journeyman
    As always, RTFM.

    WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
    Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
    YBMS, but Mozilla doesn't.

  2. #2
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877
    Hi,
    I am not sure if you already tried the VBScript function UrlEncode, instead of parsing the string you could use URLEncode function that should convert all special charecters.

    e.g.
    VB Code:
    1. <%
    2. url="hello/? &^there" & chr(34)
    3.  
    4. url=server.urlencode(url)
    5.  
    6. response.write url
    7.  
    8. %>
    would output

    hello%2F%3F+%26%5Ethere%22

    Also if you dont wanna use GET method then why not put the variable into a hidden form value and then post it.

    Hope this helps.

    Danial
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2001
    Posts
    1,140
    URLEncode will replace characters that are supposed to be in the string. But that isn't the hard part.

    I don't want to create a page with a form because I don't want to go back to the UA. I want one request to be forwarded and one page to be loaded by the requester. If I make a page with a form and submit that, then the requester makes a request, loads a page, and (if JavaScript is running) makes a second request to load a second page.

    Now, I'm fine with the limitations (sending a response back to the original requester and just dumping the request from the paging provider into /dev/null). But I can't risk going back to the client twice.
    Travis, Kung Foo Journeyman
    As always, RTFM.

    WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
    Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
    YBMS, but Mozilla doesn't.

  4. #4
    Frenzied Member monte96's Avatar
    Join Date
    Sep 2000
    Location
    Somewhere in AZ
    Posts
    1,379
    It doesn't have to really. You can do the submit with a response.write. Javascript being disabled is still a risk although a small one- if it was, most everything on the web wouldn't work either.

    I don't think there is a way within ASP/VBScript to do this without something going back to the client at some point. At least not as a HTTP post. You could probably write a COM object that posted the data for you. You would just have to create your own HTTP headers..
    oOOo--oOOo
    __/\/\onte96
    oOOo--oOOo
    Senior Programmer/Analyst
    MCP
    [email protected]
    [email protected]


    Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..

  5. #5
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    I believe the MSXML Components can do a HTTP POST.
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

  6. #6

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2001
    Posts
    1,140
    I think you are right there, Josh. Though I haven't gone down that route.

    This is all resolved, and here is my funny story.

    The head developer here at my client's site doesn't want to admit that the DLL he (poorly) wrote should not let certain characters be sent. So it was pushed on to me to make an in between ASP to clean up the work for the one proprietary paging provider who happens to be strict on the best practices.

    Well, I figure that I can make the POST the same way this DLL does, by calling an INet object (wininet.dll or winhttp.dll or something like that). As I'm looking over the horrible code in the application DLL that actually makes the POST via the system DLL, I say to myself, "Self, if I put a single line of code right here the whole thing will be fixed."

    So screw trying to make a work around, I'll actually fix the problem. But since this product belongs to my client and not me, I guess my fix won't be folded into the main build tree (they just now got version control).
    Travis, Kung Foo Journeyman
    As always, RTFM.

    WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
    Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
    YBMS, but Mozilla doesn't.

  7. #7
    Member
    Join Date
    Apr 1999
    Location
    Hyderabad,AndraPradesh,India
    Posts
    59
    try this attachment

    first execute the first.html
    u will find the result in third.asp

    anand S
    Attached Files Attached Files

Posting Permissions

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



Click Here to Expand Forum to Full Width