Telerik Forums
Community Forums Forum
4 answers
156 views
I have developed a Google Gadget called Expense Tracker using Telerik's RadControls for Silverlight.
Asit Aithal
Top achievements
Rank 2
 answered on 18 Apr 2009
2 answers
1.7K+ views
Hi

From VB.NET I want to simulate the POST request of the following HTML form

<html>   
<title>HTTP Post Testing</title>   
<body>   
<form action=http://www.example.com/postdata   
enctype="multipart/form-data" method="post" name="testform">   
<input id="user_login" name="user[login]" size="30" type="hidden"   
value="user01" />   
<input id="user_password" name="user[password]" size="30"   
type="hidden" value="123456" />   
               <table>   
                       <tr>   
                               <td>File:</td>   
 
                               <td><input id="file" name="file"   
type="file" /></td>   
                       </tr>   
                       <tr>   
                               <td colspan="2"><input name="commit"   
type="submit" value="Upload" name="upload"/></td>   
                       </tr>   
               </table>   
       </form>   
</body>   
</html>  

The target URL would return "OK" for successful upload and empty otherwise.

My code to generate the POST request is as followed:

        Try 
            Dim request As HttpWebRequest = CType(WebRequest.Create(Me.txtURL.Text), HttpWebRequest) 'this textbox contains the target URL of the request  
            ' Set the Method property of the request to POST.  
            request.Method = "POST" 
            request.Accept = "*/*" 
            request.UserAgent = "curl/7.16.3" 
            request.ProtocolVersion = HttpVersion.Version11  
            request.Referer = "http://www.mydomain.com/" 
            request.SendChunked = True 
 
            System.Net.ServicePointManager.Expect100Continue = False 
 
            ' Create POST data and convert it to a byte array.  
            Dim postData As String = "" 
 
            postData += Boundary + Chr(13) + Chr(10) + "Content-Disposition: form-data; name=""user[login]""" + Chr(13) + Chr(10) + Chr(13) + Chr(10)  
            postData += "gape" + Chr(13) + Chr(10)  
            postData += Boundary + Chr(13) + Chr(10) + "Content-Disposition: form-data; name=""user[password]""" + Chr(13) + Chr(10) + Chr(13) + Chr(10)  
            postData += "telipoint8" + Chr(13) + Chr(10)  
            postData += Boundary + Chr(13) + Chr(10) + "Content-Disposition: form-data; name=""file""; filename=""helpcurl.txt""" + Chr(13) + Chr(10)  
            postData += "Content-Type: text/plain" + Chr(13) + Chr(10) + Chr(13) + Chr(10)  
            postData += "fdfgfggfbfgggggggggggggggg" + Chr(13) + Chr(10) + Boundary + "--" + Chr(13) + Chr(10)  
 
            Dim encoding As New System.Text.ASCIIEncoding()  
            Dim byteArray As Byte() = encoding.GetBytes(postData)  
 
            ' Set the ContentType property of the WebRequest.  
            'request.ContentType = "application/x-www-form-urlencoded"  
            request.ContentType = "multipart/form-data; boundary=" + Me.Boundary + vbCrLf + vbCrLf  
            ' Set the ContentLength property of the WebRequest.  
            request.ContentLength = byteArray.Length  
 
            ' Get the request stream.  
            Dim dataStream As Stream = request.GetRequestStream()  
            ' Write the data to the request stream.  
            dataStream.Write(byteArray, 0, byteArray.Length)  
            ' Close the Stream object.  
            dataStream.Close()  
 
            ' Get the response.  
            Dim response As WebResponse = request.GetResponse()  
            ' Display the status.  
            MsgBox(CType(response, HttpWebResponse).StatusDescription, MsgBoxStyle.Information, "Response Code")  
 
            ' Get the stream containing content returned by the server.  
            dataStream = response.GetResponseStream()  
 
            ' Open the stream using a StreamReader for easy access.  
            Dim reader As New StreamReader(dataStream)  
            ' Read the content.  
            Dim responseFromServer As String = reader.ReadToEnd()  
 
            ' Display the content.  
            txtResponse.Text = responseFromServer 'this textbox shows the response from the server  
 
            ' Clean up the streams.  
            reader.Close()  
            dataStream.Close()  
            response.Close()  
        Catch Ex As Exception  
            MsgBox(Ex.Message, MsgBoxStyle.Exclamation, "Error Encountered")  
        End Try 

Here I tried to simulate the upload of a text file. When I tried this code the server alays return 404 (Resource not Found) even though the URL is correct. When the ContentType is changed to "application/x-www-form-urlencoded", i.e. no file upload but only transfer normal text fields, the server seems to accept the request and returns empty (unsucessful upload), which is correct. When I tried the above code (with content-type=multipart-formdata) against an ASP script put on my locahost:

<%  
 
test1 = Request.Form("user[login]")  
test2 = Request.Form("user[password]")  
 
Response.Write(test1 + "<br>" + test2)  
 
%> 

my script returns empty strings, which means the POST request generated by my VB code is malformed. But I cannot see what's wrong. I have compared it to the output of the following curl command

curl -F user[login]=user01 -F user[password]=123456 -F
file=@myfile.txt http://www.readysnap.com/print/mup and everything is exactly the same.

Can anyone suggest what's wrong? Thanks. :)
Alex
Top achievements
Rank 1
 answered on 16 Apr 2009
0 answers
236 views
It is our pleasure to announce the immediate availability of RadControls for WinForms Q1 2009 SP1 with many bug fixes and several performance optimizations across different controls. Check out the list of full Release Notes 

Enjoy!

Telerik Team
Telerik Admin
Top achievements
Rank 1
Iron
 asked on 15 Apr 2009
0 answers
94 views
We currently have an opening for a full time UI developer with experience of .NET AJAX at one of our offices in:

  • Bulgaria - Sofia
  • India - Channai
  • UK - Manchester

Please email Gavin Wheeldon gwheeldon@appliedlanguage.com and Kenny Holden kholden@appliedlanguage.com for full details. 
Gavin
Top achievements
Rank 1
 asked on 14 Apr 2009
0 answers
137 views
Hi,

I m having a radtoolbar in my page . I have placed an button control on the page . On click of the button i m opening a radwindow..when the radwindow is minimised i want that window show minimise on the radtoolbar. ie it should come and sit on radtoolbar..

If anybody knows the solution , give me soln.

Thanks,
Laila
laila
Top achievements
Rank 1
 asked on 14 Apr 2009
0 answers
125 views
Hi,
I want to share this
40 Exceptional jQuery Interface Techniques and Tutorials

Kind Regards,
Mostafa Anoosheh
Mostafa Anoosheh
Top achievements
Rank 1
 asked on 13 Apr 2009
6 answers
186 views
Hi guys,

With the Q1 2009 release, all skins submitted last year are now obsolete. As long as there will be major changes in the skins mechanism between releases, we obviously won't get any long lasting user skins. I understand perfectly that these changes are necessary, I'm just wondering how you see the skin exchange program evolving.

Was there much download of the custom skins uploaded last year?
Are you still determined to keep the exchange program alive?

In any case I uploaded a combobox skin yesterday. But I can't find the skin exchange forum, there was such a forum right?

Regards,
-DJ-
-DJ-
Top achievements
Rank 1
 answered on 07 Apr 2009
0 answers
76 views
Looking for a developer with experience in ASP.NET AJAX UI controls preferable in Texas area. We need about 40 hours of help with a project.
TelerikUser
Top achievements
Rank 1
 asked on 06 Apr 2009
0 answers
79 views
I am seeking a designer/programmer who can develop skins for RadTabStrip, RadWindow (alerts), FormDecorator (for button and checkbox), RadComboBox and possibly 1 or 2 other controls.

I have graphic mockups of the design I need as well as the palette colors.

Please respond with a description of your experience relating to skins, sample work if possible, rates and availability.  Send your response to info _AT_ Stratelogics [DOT] com and refer to this forum post.


Tree
Top achievements
Rank 1
 asked on 06 Apr 2009
1 answer
159 views
Hi,
I am using Telerik RAD Datagrid in my usercontrol which is further pasted on the aspx page.
When i allow sorting or paging true then on clicking on the header for sorting it is giving javascript error as:
htmlfile: Unknown runtime error
and the aspx dynamic page show the error in the second lastlne of below code which is autogenerated:

if

(Telerik.Web.UI.Grid.IsChildOf(args.get_postBackElement(),this.get_element())||args.get_postBackElement()==this.get_element()){

var

_3d1=$get(this._statusLabelID);

if

(_3d1){

_3d1.innerHTML=this._loadingText;

}

can anyone please suggest me what to do it is very urgent?

Nikita Gourme
Top achievements
Rank 1
 answered on 03 Apr 2009
Narrow your results
Selected tags
Tags
+? more
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?