NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page [VB.NET] Problem Posting Data

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Reply
 
LinkBack Thread Tools
Old 06-29-2009, 08:08 PM THREAD STARTER               #1 (permalink)
Senior Member
 
killaklown's Avatar
Join Date: Oct 2003
Posts: 3,472
killaklown is a splendid one to beholdkillaklown is a splendid one to beholdkillaklown is a splendid one to beholdkillaklown is a splendid one to beholdkillaklown is a splendid one to beholdkillaklown is a splendid one to beholdkillaklown is a splendid one to beholdkillaklown is a splendid one to behold
 



[VB.NET] Problem Posting Data


Im trying to post data from a VB.NET application to a web form, but its not passing the fields (it is doing a posting request)

Not all the code, just the code applicable to the problem.

Code:
    Public Client As New System.Net.WebClient
    Public Function HTTPRequest(ByVal URL As String, ByVal postString As String, Optional ByVal Method As String = "POST") As String
        Dim serverResponse() As Byte
        Dim postBytes As Byte() = System.Text.Encoding.ASCII.GetBytes(postString)
        Try
            serverResponse = Me.Client.UploadData(URL, Method, postBytes)
            ' Gets data from server!
        Catch ex As Exception

            MsgBox(ex.Message, MsgBoxStyle.Critical, ex.Source & " Error")
            Exit Function
        End Try
        Dim responseHTML As String = (System.Text.Encoding.ASCII.GetString(serverResponse))
        ' Turns server response(in bytes) into a string(HTML)
        Return responseHTML
    End Function



'Execute function code

Dim postStr As String = "type=100"
Dim submiturl As String = "http://127.0.0.1/posting.php"
        response = HTTPRequest(submiturl, postStr)
Any ideas?
killaklown is offline   Reply With Quote
Old 06-30-2009, 04:15 PM   #2 (permalink)
Domains my Dominion
 
sdsinc's Avatar
Join Date: Aug 2005
Location: Web 1.0
Posts: 9,556
sdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatness
 


Third World Education Find Marrow Donors! Find Marrow Donors! Find Marrow Donors! Find Marrow Donors! Animal Rescue Animal Cruelty AIDS/HIV Animal Rescue Wildlife Breast Cancer Animal Rescue Wildlife
Here is an example that should work.
Need to add some error handling.
PHP Code:
Imports System.Net
Imports System
.IO

Public Class Form1
    Inherits System
.Windows.Forms.Form
????: NamePros.com http://www.namepros.com/programming/593228-vbulletin-net-problem-posting-data.html

    
Private Sub Button1_Click(ByVal sender As System.ObjectByVal e As System.EventArgsHandles Button1.Click
????: NamePros.com http://www.namepros.com/showthread.php?t=593228
        Dim web_post 
As WebClient
        Dim byt_param 
As Byte()
        
Dim byt_data As Byte()
        
Dim str_response As String

        web_post 
= New WebClient
        
' add useful headers
        web_post.Headers.Add("Content-Type", "application/x-www-form-urlencoded")

        byt_param = System.Text.Encoding.ASCII.GetBytes("p=test&vc=&fr=yfp-t-501&toggle=1&cop=mss&ei=UTF-8&fp_ip=BE")
        byt_data = web_post.UploadData("http://search.yahoo.com/search", "POST", byt_param)

        str_response = System.Text.Encoding.ASCII.GetString(byt_data)

        MsgBox(str_response) ' 
receive the HTML back
        web_post
.Dispose()

    
End Sub 
__________________
NameNewsletter.com - free lists of available domain names
ZoneFiles.net (beta) - ccTLD and gTLD droplists
sdsinc is offline   Reply With Quote
Old 06-30-2009, 04:32 PM THREAD STARTER               #3 (permalink)
Senior Member
 
killaklown's Avatar
Join Date: Oct 2003
Posts: 3,472
killaklown is a splendid one to beholdkillaklown is a splendid one to beholdkillaklown is a splendid one to beholdkillaklown is a splendid one to beholdkillaklown is a splendid one to beholdkillaklown is a splendid one to beholdkillaklown is a splendid one to beholdkillaklown is a splendid one to behold
 



thanks

heh, just happens i got home and checked the post right after you posted
killaklown is offline   Reply With Quote
Old 07-01-2009, 11:43 AM THREAD STARTER               #4 (permalink)
Senior Member
 
killaklown's Avatar
Join Date: Oct 2003
Posts: 3,472
killaklown is a splendid one to beholdkillaklown is a splendid one to beholdkillaklown is a splendid one to beholdkillaklown is a splendid one to beholdkillaklown is a splendid one to beholdkillaklown is a splendid one to beholdkillaklown is a splendid one to beholdkillaklown is a splendid one to behold
 



Edit: got it working
Last edited by killaklown; 07-01-2009 at 01:21 PM.
killaklown is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating a new direct navigation estimation tool. Need data. dkh Domain Name Discussion 2 08-25-2007 11:32 AM
50 Paid Posting Service Listing lpstong Free Resources 2 09-08-2006 08:12 AM
#1 Bring Power to your Hosting :: UK Redbus + LA Dedicated Servers blackicehosting Web Hosting Offers 0 05-11-2005 11:57 AM

Liquid Web Smart Servers  
All times are GMT -7. The time now is 04:28 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger