473,395 Members | 1,762 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

WeBrowser Control Post Issue

I am using .net 2.0 and WebBrowser control that comes with it in C#.I
am having some issue trying to do a POST action on a Web URL. I have a
site that has two input fields in it, but when I try to submit a
request using the following code , nothing happens and the site just
show up with the User Name and Password fields being blanks.

public void SetURL(string url)
{
try
{
if (this.webBrowser1.InvokeRequired)
{
SetURLDelegeate urlDelegate = new
SetURLDelegeate(SetURL);
this.Invoke(urlDelegate, new object[] { url });
}
else
{
String postdata = PreparePostData();
if (postdata != string.Empty)
{
System.Text.Encoding a =
System.Text.Encoding.UTF8;
byte[] byte1 = a.GetBytes(postdata);
webBrowser1.Navigate(url, "", byte1,
"Content-Type: application/x-www-form-urlencoded\r\n");
}
else
webBrowser1.Url = new Uri(url);
}
}
catch (Exception exp)
{
}
}
private string PreparePostData()
{
string postData = string.Empty;
string userField = "username";
string pwdField = "password";
postData += userField.Trim() + "=";
postData += "test" + "&";
postData += pwdField.Trim() + "=";
postData += "test";
return postData;

}
I don't even see an error that login fails or any thing like that. My
guess is that WebBrowser is always sending a GET request rather than a
POST and for some reason the web server does not accept GET actions. I
appreciate your help.

Mir Kamran

Nov 23 '06 #1
0 1214

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

Similar topics

0
by: Todd | last post by:
I am trying to imbed the IE web browser control in my application. I want to sit on the text input fields on the web page and recieve keyup/keydown events. These events are not getting back to...
1
by: mike.hodgson | last post by:
Hi, I have an image in a webrowser which is 3000 pixels wide so does not fit in the browsers window. It is a CAD drawing so needs this detail. Using the scroll bars makes the image difficult to...
19
by: Dales | last post by:
I have a custom control that builds what we refer to as "Formlets" around some content in a page. These are basically content "wrapper" sections that are tables that have a colored header and...
1
by: Chase Gale | last post by:
Hello, I am developing a large financial application... In a section of the app I host a Microsoft Webbrowser control which connects to a bank and displays thier Java Applet. The problem I am...
11
by: Hoku | last post by:
I am using dual monitors on a dual head ATI AGP4x video card. I installed the Nov 11 2005 release of ATI's catalyst control center with Hydravision to manage the dual monitor setup. I recently...
3
by: chelsea | last post by:
I am using a GridView control with a ButtonField and receiving 2 row command events for each click of the button. Is there a configuration switch that I can turn that will ensure I only receive...
0
by: kamimeer | last post by:
I am using .net 2.0 and WebBrowser control that comes with it in C#.I am having some issue trying to do a POST action on a Web URL. I have a site that has two input fields in it, but when I try to...
0
by: sbuggle | last post by:
Hi, I posted an earilier post vb6 and shellexecute to accomplish my task but think this is better with the webrowser control. I have to do a search with vb6 and somehow open up the third url on...
1
by: DICKDDD | last post by:
The problem is that if you navigate the control to a page containg a flash swf object, the object will play once (suppose it has a button to do that). After it plays once it wont play again. Same...
4
by: jim | last post by:
I want to make a WYSIWYG editor for HTML pages that can detect events in the webbrowser control in real time and control the webbrowser control (and internal documents) to allow simple stuff like...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.