473,788 Members | 2,725 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

GET & POST Methods in Net.Webrequest

Hi everyone,

To bring you in the picture:

I have the function to grab the html content from the page.
Function requires only URL and Time Delay variables.
Url, which I am submitting to this function, includes many variables,
such as name and password and others...
Problem started when website I am logging to, changed the method of
logging from GET to POST.
Since then, my whole software solution, which is completely depended on
this source code, stopped working.

I am having a real trouble to figure out how to amend this code to
switch from GET to POST method:
--------------------------------------------------------
Public Function GetPageHTML(ByV al URL As String, Optional ByVal
TimeoutSeconds As Integer = 10) As String
' Retrieves the HTML from the specified URL, using a default
timeout of 10 seconds
Dim objRequest As Net.WebRequest
Dim objResponse As Net.WebResponse
Dim objStreamReceiv e As System.IO.Strea m
Dim objEncoding As System.Text.Enc oding
Dim objStreamRead As System.IO.Strea mReader

Try
' Setup our Web request
objRequest = Net.WebRequest. Create(URL)
objRequest.Time out = TimeoutSeconds * 1000

' Retrieve data from request
objResponse = objRequest.GetR esponse
objStreamReceiv e = objResponse.Get ResponseStream
objEncoding = System.Text.Enc oding.GetEncodi ng("utf-8")
objStreamRead = New
System.IO.Strea mReader(objStre amReceive, objEncoding)
' Set function return value
GetPageHTML = objStreamRead.R eadToEnd()
' Check if available, then close response
If Not objResponse Is Nothing Then
objResponse.Clo se()
End If
Catch
' Error occured grabbing data, simply return nothing
Return ""
End Try
End Function
--------------------------------------------------------
Can someone tell me what to do?
I tried to add this line:
objRequest.Meth od = "POST"
, right below the TRY, but nothing changed and I really don't know what
to do next, while all my customers are getting inpatient.

Please let me know, this is my last resource.

Martin

Nov 21 '05 #1
0 2858

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2525
by: Tim Wade | last post by:
Does anyone have any ideas on how to do an automatic html form post using hidden fields without introducing client-side script nor using a server-side WebRequest by passing the information back up to the browser while the base href is still set to my site. The problem I was having with the server-side WebRequest is that the relative links of the site I am posting to break. I could work my way around it probably by adding a base ref in the...
5
6026
by: Henrik | last post by:
Hi, I am trying to read some industrial webservers using the HTTP/CGI webequest like this: wrs = (HttpWebRequest)WebRequest.Create(HTTP/CGI-string); mwst = (HttpWebResponse wrs.GetResponse(); str = mwst.GetResponseStream(); This usually works fine but on some servers i get:
1
4825
by: LD | last post by:
Hi, I'm pulling my hair out!! My problem is, I need to automatically upload a zip file along with 3 other pieces of text data to a web server and wait for it's xml response. Basically a multipart/form-data post. I have tried it using a regular html form and it works but that is no good because it leaves you at the other server where
12
2674
by: Assaf | last post by:
Hi all, My client is using an online service provider that processes survey responses. After a user fills survey.aspx and presses the OK button, 2 things need to happen: 1. the data has to be posted behind the scenes to the provider's URL (e.g., http://www.surveyprocessingprovider.com/srvy1?field1=response1&field2=response2) 2. the user has to be redirected to thankyou.aspx.
4
2903
by: Piotr Strycharz | last post by:
Hi all I do have a problem. How can I transfer user to another server using POST. The problem is that Server.Transfer (preserves form data) works just in current server. Response.Redirect - uses GET method. However I have to open remote server page using POST method. Normally this can be achieved using <form ACTION="remote-page-url"> tag. However this is impossible with ASP.NET. Also, using WebRequest class is not good solution, as I...
0
1377
by: Brett | last post by:
I'm trying three different methods for logging into a webmail account. In Post1() and Post2(), I always get back the login page. Not the page after logging in. On TryCookies(), I'm not sure. It will run but there are some other things that need to take place. Any suggestion on what is wrong with the Post1() and Post2() or how to get TryCookies() going? Any other guidance is appreciated. Private Sub TryCookies() Dim uri As New...
0
1448
by: dkoppe | last post by:
I'm using C#.NET WebRequest and HTTPResponse to post data to a server and I'm reading the response into a stream. Does anyone know how to split the returned values like a request.form. Here is the code. Thanks! WebRequest request = WebRequest.Create("Webiste.com"); request.Method = "POST"; string postData = ""; postData += "Value1=C&"; postData += "Value2=S"; ...
4
2017
by: Stanislav Vlasic | last post by:
Hi. I'm developing application for compact framework (windows mobile 2003) in C# and have one problem. From application, I'm connecting to FTP server and downloading some files. The problem is that I can connect to ftp only when internet connection is already established on device. If there is no connection to the internet (GPRS connection in my case), application raises exception.
11
8619
by: atlaste | last post by:
Hi, In an attempt to create a full-blown webcrawler I've found myself writing a wrapper around the Socket class in an attempt to make it completely async, supporting timeouts and some scheduling mechanisms. I use a non-blocking approach for this, using the call to 'poll' to support the async mechanism - rather than the 'begin' and 'end' functions. I already found that connecting doesn't set the "isconnected" variable correctly...
0
9656
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9498
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10177
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10118
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7519
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6750
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5403
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3677
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2897
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.