Click here to Skip to main content
15,888,461 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Sorry, if my question is not posed properly but I am very new to this. I am trying to find out how to do a Post in VBNet using a Webrequest to access a report from our company's website. If you do it through Internet Explorer on the website, you get a form where you select your parameters and hit run to get the report. From the Java script, I can see the form name is "Form1" and I used Fiddler to see the parameters being sent for the report which looks like:
dirty=false&Delete=&Copy=&Save=&Reload=&FilterSetKey=0&txtSetDescription=&HDNTXT_29_5=&HDNTXT_28_4=&HDNTXT_33_3=&HDNTXT_34_3=&HDNTXT_35_3=&HDNTXT_36_9=&HDNTXT_60_3=&HDNTXT_39_7=&HDNTXT_37_7=&HDNTXT_38_7=&HDNTXT_40_3=&HDNTXT_41_3=&HDNTXT_42_3=&HDNTXT_44_3=2&HDNTXT_45_3=4%7E5%7E6&HDNTXT_46_3=&HDNTXT_47_9=&HDNTXT_27_2=01-Dec-2013&HDNTXT_20_8=1&HDNTXT_22_8=1&HDNTXT_21_8=1&DefaultFilter=No

And the address used for the post is similar to:
https://mycompanywebsite.com/apps/la/Reports/ExportDocument11.asp?ID=739&Request=Card&OpenType=Edit

Can anyone tell me how I can do a Form post from VBnet with these report parameters? Or point me to a good tutorial since I have not been able to find one. Thanks!
Posted
Comments
Sergey Alexandrovich Kryukov 1-Dec-13 21:00pm    
You don't need a tutorial, this is one relatively small piece of knowledge. Did you read documentation on HttpWebRequest?
—SA

1 solution

The idea is pretty simple. First, read the documentation on the class :
http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest%28v=vs.110%29.aspx[^].

You simply need to use the method "POST" and write your post data in the request stream.

All the tutorial you might need is contained in a single MSDN page: http://msdn.microsoft.com/en-us/library/debx8sh9.aspx[^].

You can find some simple code samples here:
http://stackoverflow.com/questions/14702902/post-form-data-using-httpwebrequest[^],
http://bytes.com/topic/net/answers/426387-form-post-via-httpwebrequest[^],
http://technet.rapaport.com/info/lotupload/samplecode/full_example.aspx[^].

—SA
 
Share this answer
 
Comments
jo106n 3-Dec-13 21:24pm    
Thanks Sergey. The one link to sample code was helpful. But according to Fiddler, I am getting an error under Transport of "Expect: 100-Continue". Trying to research but not sure how to get around. Would it be because I am using .asp?ID=739&Request=Card&OpenType=Edit in my webrequest address? I tried taking that out and adding the ID=739, Request=Card, and Type=Edit in the post but that causes a run time error.
Sergey Alexandrovich Kryukov 3-Dec-13 22:17pm    
This detail doesn't tell me much. One of the ideas is this: start with doing it in some browser and make sure the request works. Use some HTML spy program to see what it does. Try to reproduce all the detail.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900