Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > HTTP Handlers

Thread Tools

HTTP Handlers

Ertan Sekmen
Posts: n/a
hi there,
I do not know if this is the correct form to post this but I would kindly
ask any help on creating a class to submit a Form.

We have a webservice that accepts web forms. when we create a form with a
textarea called data, (the value is an XMLDocument) then submit this form
via action=https://blabla... it works fine. But I would like to implement
this operation in our business layer, which is a class.

I started with creating httpwebrequest object. but "result" string is always
empty. I try this another web page, it works great.

I think that the blabla server process only web forms, something like
request.form("data"). How can I add form values to httprequest? I search
through msdn and I Found that there are two objects : System.Web.HttpRequest
and System.Net.HttpWebRequest. I cannot get System.Web.HttpRequest object
working. when I try to add a value & key pair to
System.Web.HttpRequest.forms collection it raises an error : "forms
collection is read only".

Thanks in advance,

'-- code begins here
Dim oRequest As HttpWebRequest = WebRequest.Create("https://blabla")

Dim myWriter As StreamWriter
Dim encoding As New ASCIIEncoding
Dim postData As String

Dim result As String
Dim xmlFile As String = New StreamReader("c:\xmldoc.xml").ReadToEnd
postData = "DATA=" & xmlFile
Dim data As Byte() = encoding.GetBytes(postData)
oRequest.Form.Set("DATA", postData)
oRequest.Method = "POST"
oRequest.ContentLength = data.Length
oRequest.ContentType = "application/x-www-form-urlencodedl"
oRequest.KeepAlive = True
Dim newStream As Stream = oRequest.GetRequestStream()
newStream.Write(Data, 0, Data.Length)
Catch ex As Exception
End Try

Dim oResponse As HttpWebResponse = oRequest.GetResponse()
Dim sr As StreamReader = New
result = sr.ReadToEnd

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Http handlers and session state Eran Kampf ASP .Net 1 09-23-2004 09:29 PM
HTTP handlers/Modules vs ISAPI dlls Norton ASP .Net 2 08-23-2004 01:47 AM
HTTP Handlers =?Utf-8?B?Qw==?= ASP .Net 3 06-10-2004 04:56 PM
HTTP Modules & Handlers or ISAPI? PCC ASP .Net 3 10-24-2003 05:39 PM
HTTP handlers - Maintaining global objects, and multi-threading Chris Hughes ASP .Net 5 08-21-2003 04:12 AM