473,800 Members | 2,323 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.webBrowse r1.InvokeRequir ed)
{
SetURLDelegeate urlDelegate = new
SetURLDelegeate (SetURL);
this.Invoke(url Delegate, new object[] { url });
}
else
{
String postdata = PreparePostData ();
if (postdata != string.Empty)
{
System.Text.Enc oding a =
System.Text.Enc oding.UTF8;
byte[] byte1 = a.GetBytes(post data);
webBrowser1.Nav igate(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 1402

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

Similar topics

0
344
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 my C# application. I saw a tech note and a hot fix for this problem for .NET 1.0.. but i'm using ..NET 1.1 (Visual Studio 2003). Did this problem re-surface?
1
9479
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 view so I am looking for some code where I can set the view width to 1000 pixels and the code will allow me to zoom in and out of the image and pan it around the page, a bit like how google maps works. Can anyone help me with this please. It...
19
2991
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 provide an open TD with a DIV in it for the content of this formlet. (The DIV is for DHTML to hide and show the content) I've created a web page showing step by step the two problems I'm encountering. This problem is much easier to see than it...
1
1010
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 having is occasionally (and excuse my bias against JVM's) the applet locks up for 10 - 30 seconds... when the applet locks up, the whole app goes "Not Responding" until it resolves itself.
3
8852
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 one call to my handler? I'm using the most basic wiring as it comes out of VS 2005.. Thanks in advance for your help! ex/ <%@ Page Language="C#" AutoEventWireup="false" CodeFile="Default2.aspx.cs" Inherits="Default2" %>
0
1231
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 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) {
0
1097
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 the search page. On the form there is textbox = search criteria command button search
1
1525
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 page works just fine in IE6 or IE7 problem is just in the browser. In searching for answer (hours and hours! thank you ms) I found a solution that declares a new class overiding the browser control and changes one of the functions. I tried to put...
4
1387
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 dragging and dropping HTML controls on the webbrowser control. The goal is a real-time view of the page as it is edited. Is it possible for a .Net app to trap these events and respond accordingly? I have googled for soem code examples, but...
0
9691
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10505
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10276
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10253
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10035
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7580
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6813
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5471
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
2945
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.