Results 1 to 16 of 16

Thread: Opening a ASP page with POST from a VB programm

  1. #1
    Senior Member GAteKeeper's Avatar
    Join Date
    Feb 2004
    Location
    Derbyshire, UK
    Posts
    584
    Thanks
    14
    Thanked
    34 times in 23 posts
    • GAteKeeper's system
      • Motherboard:
      • MSI P67-GD5
      • CPU:
      • Intel i7 2600k
      • Memory:
      • 8Gb Corsair DDR3 1600
      • Storage:
      • ~44TB
      • Graphics card(s):
      • 980Ti
      • PSU:
      • Seasonic S12 600W
      • Case:
      • Lian Li PC-65
      • Operating System:
      • Win10 64bit
      • Monitor(s):
      • Dell U3415W & 2405fpw
      • Internet:
      • 45Mb vDSL

    Question Opening a ASP page with POST from a VB programm

    I have an Access dB that needs to open a web page passing some things:

    Oracle Login
    At least 1 ID

    Now I could write a down and dirty way of doing this buy creating an html page on the fly with a bit of java script that auto submits on open and opening it in the default browser. But this is not the best situation as the username/password would exist as files on the HDD (if only for a short space of time).

    Is there a nice way of creating a VB object with the POST & ACTION statements set and then opening it in IE.

    I am a fairly good programmer (I get paid to do so cant be too bad) and willing to try most ideas out.

    GAteKeeper
    Keeper of the Gates of Hell

  2. #2
    Sublime HEXUS.net
    Join Date
    Jul 2003
    Location
    The Void.. Floating
    Posts
    11,819
    Thanks
    213
    Thanked
    233 times in 160 posts
    • Stoo's system
      • Motherboard:
      • Mac Pro
      • CPU:
      • 2*Xeon 5450 @ 2.8GHz, 12MB Cache
      • Memory:
      • 32GB 1600MHz FBDIMM
      • Storage:
      • ~ 2.5TB + 4TB external array
      • Graphics card(s):
      • ATI Radeon HD 4870
      • Case:
      • Mac Pro
      • Operating System:
      • OS X 10.7
      • Monitor(s):
      • 24" Samsung 244T Black
      • Internet:
      • Zen Max Pro
    Start from the beginning, what exactly are you trying to do?

    You're not making an awful lot of sense in the above post..
    (\__/)
    (='.'=)
    (")_(")

  3. #3
    Senior Member GAteKeeper's Avatar
    Join Date
    Feb 2004
    Location
    Derbyshire, UK
    Posts
    584
    Thanks
    14
    Thanked
    34 times in 23 posts
    • GAteKeeper's system
      • Motherboard:
      • MSI P67-GD5
      • CPU:
      • Intel i7 2600k
      • Memory:
      • 8Gb Corsair DDR3 1600
      • Storage:
      • ~44TB
      • Graphics card(s):
      • 980Ti
      • PSU:
      • Seasonic S12 600W
      • Case:
      • Lian Li PC-65
      • Operating System:
      • Win10 64bit
      • Monitor(s):
      • Dell U3415W & 2405fpw
      • Internet:
      • 45Mb vDSL
    Ok, I have an access database hooked into an oracle backend. Its used to infrequently maintain a list of courses.

    The rest of the system is written in ASP VBScript. I need to be able to have a button in my system that opens a web browser and automatically logins into the correct page passing the ID of the currently selected course so the user can look at the budgets based on that course. The login is an oracle login maintained across the systems.

    I can open a web browser no problem but for obvious reasons (like the username and password would be totally visible) we dont want to use the GET method of passing variables to the web page. Instead I want to use hte POST method.

    So I need to create a VB object add some parameters and open it (if this sort of VB object even exists)

    Hope this clarifies my question.

    GAteKeeper
    Keeper of the Gates of Hell

  4. #4
    bored out of my tiny mind malfunction's Avatar
    Join Date
    Jul 2003
    Location
    Lurking
    Posts
    3,923
    Thanks
    191
    Thanked
    187 times in 163 posts
    • malfunction's system
      • Motherboard:
      • Gigabyte G1.Sniper (with daft heatsinks and annoying Killer NIC)
      • CPU:
      • Xeon X5670 (6 core LGA 1366) @ 4.4GHz
      • Memory:
      • 48GB DDR3 1600 (6 * 8GB)
      • Storage:
      • 1TB 840 Evo + 1TB 850 Evo
      • Graphics card(s):
      • 290X
      • PSU:
      • Antec True Power New 750W
      • Case:
      • Cooltek W2
      • Operating System:
      • Windows 10
      • Monitor(s):
      • Dell U2715H
    So access is only used as a GUI? And oracle is 'accessed' via an ODBC DSN?

    Also - why not just make all the GUI stuff the webpage?

    FWIW you can do this in VBScript - not sure if it's the same in VBA (which is what I presume you are using):

    Code:
    Function httpGet(url)
    	Set objHttpReq = CreateObject("WinHttp.WinHttpRequest.5.1")
    	
    	objHttpReq.Open "GET", url, false
    	objHttpReq.Send
    
    	httpGet = objHttpReq.ResponseText
    End Function
    
    Function httpPost(url, postdata)
    	Set objHttpReq = CreateObject("WinHttp.WinHttpRequest.5.1")
    	
    	objHttpReq.Open "PUT", url, false
    	objHttpReq.Send postdata
    
    	httpPost = objHttpReq.ResponseText
    End Function
    But that will only let you do 'raw' requests from the code - it won't pop IE open with the results page.

  5. #5
    bored out of my tiny mind malfunction's Avatar
    Join Date
    Jul 2003
    Location
    Lurking
    Posts
    3,923
    Thanks
    191
    Thanked
    187 times in 163 posts
    • malfunction's system
      • Motherboard:
      • Gigabyte G1.Sniper (with daft heatsinks and annoying Killer NIC)
      • CPU:
      • Xeon X5670 (6 core LGA 1366) @ 4.4GHz
      • Memory:
      • 48GB DDR3 1600 (6 * 8GB)
      • Storage:
      • 1TB 840 Evo + 1TB 850 Evo
      • Graphics card(s):
      • 290X
      • PSU:
      • Antec True Power New 750W
      • Case:
      • Cooltek W2
      • Operating System:
      • Windows 10
      • Monitor(s):
      • Dell U2715H
    Reference for WinHTTPRequest (top tip - google using "WinHTTPRequest site:msdn.microsoft.com" or any other object name / MS programming thing):

    http://msdn.microsoft.com/library/de...ttprequest.asp

  6. #6
    Sublime HEXUS.net
    Join Date
    Jul 2003
    Location
    The Void.. Floating
    Posts
    11,819
    Thanks
    213
    Thanked
    233 times in 160 posts
    • Stoo's system
      • Motherboard:
      • Mac Pro
      • CPU:
      • 2*Xeon 5450 @ 2.8GHz, 12MB Cache
      • Memory:
      • 32GB 1600MHz FBDIMM
      • Storage:
      • ~ 2.5TB + 4TB external array
      • Graphics card(s):
      • ATI Radeon HD 4870
      • Case:
      • Mac Pro
      • Operating System:
      • OS X 10.7
      • Monitor(s):
      • 24" Samsung 244T Black
      • Internet:
      • Zen Max Pro
    Just bypass access completely and create an asp page to pull the info out of Oracle directly?
    (\__/)
    (='.'=)
    (")_(")

  7. #7
    bored out of my tiny mind malfunction's Avatar
    Join Date
    Jul 2003
    Location
    Lurking
    Posts
    3,923
    Thanks
    191
    Thanked
    187 times in 163 posts
    • malfunction's system
      • Motherboard:
      • Gigabyte G1.Sniper (with daft heatsinks and annoying Killer NIC)
      • CPU:
      • Xeon X5670 (6 core LGA 1366) @ 4.4GHz
      • Memory:
      • 48GB DDR3 1600 (6 * 8GB)
      • Storage:
      • 1TB 840 Evo + 1TB 850 Evo
      • Graphics card(s):
      • 290X
      • PSU:
      • Antec True Power New 750W
      • Case:
      • Cooltek W2
      • Operating System:
      • Windows 10
      • Monitor(s):
      • Dell U2715H
    Quote Originally Posted by Stoo
    Just bypass access completely and create an asp page to pull the info out of Oracle directly?
    Aye - that's what I was trying to say with this:

    Quote Originally Posted by Me
    Also - why not just make all the GUI stuff the webpage?
    ASP would have no problem running queries on both databases.

    If that's not an option though it would help us understand it more if you could define which bits do what

  8. #8
    Senior Member GAteKeeper's Avatar
    Join Date
    Feb 2004
    Location
    Derbyshire, UK
    Posts
    584
    Thanks
    14
    Thanked
    34 times in 23 posts
    • GAteKeeper's system
      • Motherboard:
      • MSI P67-GD5
      • CPU:
      • Intel i7 2600k
      • Memory:
      • 8Gb Corsair DDR3 1600
      • Storage:
      • ~44TB
      • Graphics card(s):
      • 980Ti
      • PSU:
      • Seasonic S12 600W
      • Case:
      • Lian Li PC-65
      • Operating System:
      • Win10 64bit
      • Monitor(s):
      • Dell U3415W & 2405fpw
      • Internet:
      • 45Mb vDSL
    The reason its not all ASP based is because they dont want to pay me to do.

    Just reading up on the MSDN articles. Ta for the pointers.

    GK
    Keeper of the Gates of Hell

  9. #9
    Senior Member GAteKeeper's Avatar
    Join Date
    Feb 2004
    Location
    Derbyshire, UK
    Posts
    584
    Thanks
    14
    Thanked
    34 times in 23 posts
    • GAteKeeper's system
      • Motherboard:
      • MSI P67-GD5
      • CPU:
      • Intel i7 2600k
      • Memory:
      • 8Gb Corsair DDR3 1600
      • Storage:
      • ~44TB
      • Graphics card(s):
      • 980Ti
      • PSU:
      • Seasonic S12 600W
      • Case:
      • Lian Li PC-65
      • Operating System:
      • Win10 64bit
      • Monitor(s):
      • Dell U3415W & 2405fpw
      • Internet:
      • 45Mb vDSL
    I was trying ot avoid having to do something like this:
    Code:
    <html>
    <head>
    <SCRIPT lang=JavaScript>
    <!--
    function submitform()
    {
    document.forms.form1.submit;
    }
    //-->
    </SCRIPT>
    </head>
    <body onLoad="submitform()">
    <form name="form1" action="http://someserver/ASP/somepage.asp" method="POST">
    <input name="Username" type="Hidden" value="User123">
    <input name="Password" type="Hidden" value="Password57">
    <input name="CourseID" type="Hidden" value="45732">
    </body>
    </html>
    Open an IE window - set the html to that (although as it was written off the top of my head there has got to be an error in it) and run it

    Not an amazing eligant way of doing it but it should work

    GAteKeeper
    Last edited by GAteKeeper; 06-01-2005 at 05:54 PM.
    Keeper of the Gates of Hell

  10. #10
    bored out of my tiny mind malfunction's Avatar
    Join Date
    Jul 2003
    Location
    Lurking
    Posts
    3,923
    Thanks
    191
    Thanked
    187 times in 163 posts
    • malfunction's system
      • Motherboard:
      • Gigabyte G1.Sniper (with daft heatsinks and annoying Killer NIC)
      • CPU:
      • Xeon X5670 (6 core LGA 1366) @ 4.4GHz
      • Memory:
      • 48GB DDR3 1600 (6 * 8GB)
      • Storage:
      • 1TB 840 Evo + 1TB 850 Evo
      • Graphics card(s):
      • 290X
      • PSU:
      • Antec True Power New 750W
      • Case:
      • Cooltek W2
      • Operating System:
      • Windows 10
      • Monitor(s):
      • Dell U2715H
    Quote Originally Posted by GAteKeeper
    I was trying ot avoid having to do something like this:
    Code:
    <html>
    <head>
    <SCRIPT lang=JavaScript>
    <!--
    function submitform()
    {
    document.forms.form1.submit;
    }
    //-->
    </SCRIPT>
    </head>
    <body onLoad="submitform()">
    <form name="form1" action="http://someserver/ASP/somepage.asp" method="POST">
    <input name="Username" type="Hidden" value="User123">
    <input name="Password" type="Hidden" value="Password57">
    <input name="CourseID" type="Hidden" value="45732">
    </body>
    </html>
    Open an IE window - set the html to that (although as it was written off the top of my head there has got to be an error in it) and run it

    Not an amazing eligant way of doing it but it should work

    GAteKeeper

    If you know how to pass HTML to IE to display then you could do the HTTP post from within access - though it's a bit of a kludge either way. Maybe you should try and convince them to spend more on the website anyway?

  11. #11
    Senior Member GAteKeeper's Avatar
    Join Date
    Feb 2004
    Location
    Derbyshire, UK
    Posts
    584
    Thanks
    14
    Thanked
    34 times in 23 posts
    • GAteKeeper's system
      • Motherboard:
      • MSI P67-GD5
      • CPU:
      • Intel i7 2600k
      • Memory:
      • 8Gb Corsair DDR3 1600
      • Storage:
      • ~44TB
      • Graphics card(s):
      • 980Ti
      • PSU:
      • Seasonic S12 600W
      • Case:
      • Lian Li PC-65
      • Operating System:
      • Win10 64bit
      • Monitor(s):
      • Dell U3415W & 2405fpw
      • Internet:
      • 45Mb vDSL
    Not sure its not on the cards anyway BUT I need a proof of concept to demonstrate its possible, which it must be.

    TA for you help

    GK
    Keeper of the Gates of Hell

  12. #12
    Senior Member GAteKeeper's Avatar
    Join Date
    Feb 2004
    Location
    Derbyshire, UK
    Posts
    584
    Thanks
    14
    Thanked
    34 times in 23 posts
    • GAteKeeper's system
      • Motherboard:
      • MSI P67-GD5
      • CPU:
      • Intel i7 2600k
      • Memory:
      • 8Gb Corsair DDR3 1600
      • Storage:
      • ~44TB
      • Graphics card(s):
      • 980Ti
      • PSU:
      • Seasonic S12 600W
      • Case:
      • Lian Li PC-65
      • Operating System:
      • Win10 64bit
      • Monitor(s):
      • Dell U3415W & 2405fpw
      • Internet:
      • 45Mb vDSL
    Right I have my solution:

    After much searching in some thing I had already looked into I found a POST data bit hidden in the IE automation object (Reference: Microsoft Internet Controls) that uses .Navigate(URL, Options, Frame, PostData, Headers).

    I struggled to get it to work at first but after re-reading the spec of Navigate I realised that PostData needs to be an array of Bytes - hence the conversion line.

    Code:
        Dim IeApp As InternetExplorer
        Dim sURL As String
        Dim sPostdata As String
        Dim bPostdata() As Byte
        Dim i As Long
        Dim heading
        Dim frame
        Dim zero
        
        'Create new instance of IE
        Set IeApp = CreateObject("InternetExplorer.application")
        
        'Make it visible - some things don’t work
        'unless it’s visible
        IeApp.Visible = True
        
        'define the page to open
        sURL = "http://192.168.1.44/JBH/test_form_returns.asp"
        sPostdata = "username=" & Me.user
        sPostdata = sPostdata & "&password=" & Me.pass
        sPostdata = sPostdata & "&courseID=" & Me.courseID
        'Convert the string to a byte array
        bPostdata = StrConv(sPostdata, vbFromUnicode)
        heading = "Content-Type: application/x-www-form-urlencoded" & vbCrLf
        frame = "" ' "_SELF"
        zero = 0 'no history
    
        'navigate to the page
        IeApp.Navigate sURL, zero, frame, bPostdata, heading
     
        
        'Pause the macro using a loop until the
        'page is fully loaded
        'Do
        'Loop Until IeApp.ReadyState = READYSTATE_COMPLETE
        
     
        'Clean up
        'IeApp.Quit
        Set IeApp = Nothing
    Cheers for all your help

    GAteKeeper
    Last edited by GAteKeeper; 06-01-2005 at 09:28 PM. Reason: Fixed a multiple window bug
    Keeper of the Gates of Hell

  13. #13
    Goat Boy
    Join Date
    Jul 2003
    Location
    Alexandra Park, London
    Posts
    2,428
    Thanks
    0
    Thanked
    0 times in 0 posts
    LOL this thread reminds me why I dumped MS and learnt Java
    "All our beliefs are being challenged now, and rightfully so, they're stupid." - Bill Hicks

  14. #14
    Uber Geek
    Join Date
    Sep 2004
    Location
    Leeds, W Yorks
    Posts
    598
    Thanks
    2
    Thanked
    4 times in 4 posts
    There's a nice easy object to use for getting and posting to web sites...

    It's the XMLHTTP object. It's a Microsoft object and is well documented on the web. I've used it in ASP to talk Server->Server.

    This would allow you to pass data back and forth transparently (you can even do it Asynchronously if you like) without the user even knowing a second server was being accessed.

    Here's a good place to start: http://www.4guysfromrolla.com/webtech/110100-1.shtml

  15. #15
    Sublime HEXUS.net
    Join Date
    Jul 2003
    Location
    The Void.. Floating
    Posts
    11,819
    Thanks
    213
    Thanked
    233 times in 160 posts
    • Stoo's system
      • Motherboard:
      • Mac Pro
      • CPU:
      • 2*Xeon 5450 @ 2.8GHz, 12MB Cache
      • Memory:
      • 32GB 1600MHz FBDIMM
      • Storage:
      • ~ 2.5TB + 4TB external array
      • Graphics card(s):
      • ATI Radeon HD 4870
      • Case:
      • Mac Pro
      • Operating System:
      • OS X 10.7
      • Monitor(s):
      • 24" Samsung 244T Black
      • Internet:
      • Zen Max Pro
    The thing is, it really wouldn't have been any more difficult to build a simple asp page to do the lot, in fact it probably would have been easier..
    (\__/)
    (='.'=)
    (")_(")

  16. #16
    Senior Member GAteKeeper's Avatar
    Join Date
    Feb 2004
    Location
    Derbyshire, UK
    Posts
    584
    Thanks
    14
    Thanked
    34 times in 23 posts
    • GAteKeeper's system
      • Motherboard:
      • MSI P67-GD5
      • CPU:
      • Intel i7 2600k
      • Memory:
      • 8Gb Corsair DDR3 1600
      • Storage:
      • ~44TB
      • Graphics card(s):
      • 980Ti
      • PSU:
      • Seasonic S12 600W
      • Case:
      • Lian Li PC-65
      • Operating System:
      • Win10 64bit
      • Monitor(s):
      • Dell U3415W & 2405fpw
      • Internet:
      • 45Mb vDSL
    *Rolls eyes*

    I was trying to pass oracle login details to the web page (as well as a couple of IDs). Not to get data from ASP pages but pass control to a separate ASP system.

    GAteKeeper
    Keeper of the Gates of Hell

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. asp page widgets
    By scottyman in forum Software
    Replies: 7
    Last Post: 24-11-2004, 09:21 PM
  2. The post count/avatar thread
    By Zathras in forum General Discussion
    Replies: 39
    Last Post: 25-07-2003, 08:38 AM

Posting Permissions

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