Click here to Skip to main content
15,889,335 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
The following source-code displays Navpost.aspx on a System.Windows.Forms Namespace WebBrowser class, but without the post values? Any suggestions for getting the data posted from my code to the html page?

== MY HTML Navpost.aspx =================
XML
<HTML>
<%
Dim cFlavor, cName
cFlavor = Request("Flavor")
cName = Request("FName")
%>
<BODY>
Hello, <% =cName %>. <br>
One scoop of <% =cFlavor %> coming right up!
</BODY>
</HTML>



== MY SOURCE CODE =======================
MIDL
byte[] SomeBytes = null;
string cPostData = "FName=Allan&Flavor=Vanilla";
SomeBytes = Encoding.UTF8.GetBytes(cPostData);
WebBrowser1.Navigate("http://localhost/Navpost.aspx", "_self", SomeBytes,
        "Content-Type: application/x-www-form-urlencoded\n\r");
Posted
Updated 27-Jul-10 4:19am
v2

Everything looks fine, except that '\n\r' should be '\r\n' or just use Environment.NewLine
 
Share this answer
 
Thank you for noticing the CRLF was backward; I got this code from a web-site. However, correcting the CRLF didn’t help. The original code was written for Visual Studio 2005 and I’m using 2008, so I had to change the arguments for the Navigate class since the new .NET version didn’t have the older set of arguments.
 
Share this answer
 
Comments
Rutvik Dave 28-Jul-10 17:23pm    
Are you getting any exception ? try catching the following exceptions 1) ObjectDisposedException 2) InvalidOperationException. or check if your ASP.Net application security is on FullTrust.

I don't see any other problem with this.
Allan Larson 28-Jul-10 18:02pm    
Thank you. I'm using UriFormatException and InvalidOperationException for the Navigate class try/catch, but the compiler did not like ObjectDisposedException. None of these execeptions are being called. I’m using an Apache server for my localhost; how would I check if the ASP has a security issue?
When I started to do research on my new automobile, I came across this page that showed me everything I needed to know about how to purchase a new car. There are more ways than you could think of that the dealership makes money off of every sale; doc fees, holdbacks, finance charges, and so many more. I went to this web site and they sent me FREE information on how to negotiate with a auto dealer and how to purchase a new car below invoice. After reading everything that they sent over to me, I was much more educated on the buying process and wanted to share that with all of you. I simply printed the eBook, brought it to the dealership, and I walked out of there paying less than invoice. If you are in the market for a new car, this is some must read information and it is FREE. Take a look and please post any other advice you might have to help others who are buying a new car.
[url=http://www.newacuraincentives.com/freebook.html]Auto Negotiation Tips and Secrets eBook[/url]
 
Share this answer
 

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