473,405 Members | 2,262 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,405 software developers and data experts.

POSTing a form programatically

I am trying to programatically POST an ASP form, to allow me to log on
to a site programatically.

<form name="aspnetForm" method="post" action="Default.aspx"
id="aspnetForm">
<input name="_ct99:Content:UsrName" type="text"
id="_ct99_Content_UsrName" />
<input name="_ct99:Content:Pwd" type="password"
id="_ct99_Content_Pwd" />
<input type="submit" name="_ct99:Content:btnLogon" value="Logon"
id="_ct99_Content_btnLogon" />
<input id="_ct99_Content_SavePwd" type="checkbox"
name="_ct99:Content:SavePwd" /></p>
</form>
What I find strange/confusing is that the name attribute of the elements
(i.e. the controls) are not 'legal' (i.e. they contain colons etc).

I need the 'name'='value' pairs to use in the POST.

I am using an external library (cURL) to do the POST action, so far I
have failed to log on when using either the name attribute (looked
suspicious anyway), but I also failed to log on when I used the id
attribute.

The "problem" definitely lies with this ASP.Net page, since I have
successfully logged on other pages using the post method.

Any ideas/suggestions (or preferably solutions) would be most welcome
Jul 12 '07 #1
2 2073
asp.net 1.1 used illegal names (so does asp.net 2.0, but its only the
breaking the first letter rule by using an "_", it replaced ":" with "$").

if this is a asp.net site, you need to also send the __VIEWSTATE with
the post. you can not hard code this. you must do a get, and parse the
html to get a valid _VIEWSTATE to send with the post. depending on how
the page was written, you may need to send _EVENTTARGET (say the login
is a link button).

-- bruce (sqlwork.com)

Grey Alien wrote:
I am trying to programatically POST an ASP form, to allow me to log on
to a site programatically.

<form name="aspnetForm" method="post" action="Default.aspx"
id="aspnetForm">
<input name="_ct99:Content:UsrName" type="text"
id="_ct99_Content_UsrName" />
<input name="_ct99:Content:Pwd" type="password"
id="_ct99_Content_Pwd" />
<input type="submit" name="_ct99:Content:btnLogon" value="Logon"
id="_ct99_Content_btnLogon" />
<input id="_ct99_Content_SavePwd" type="checkbox"
name="_ct99:Content:SavePwd" /></p>
</form>
What I find strange/confusing is that the name attribute of the elements
(i.e. the controls) are not 'legal' (i.e. they contain colons etc).

I need the 'name'='value' pairs to use in the POST.

I am using an external library (cURL) to do the POST action, so far I
have failed to log on when using either the name attribute (looked
suspicious anyway), but I also failed to log on when I used the id
attribute.

The "problem" definitely lies with this ASP.Net page, since I have
successfully logged on other pages using the post method.

Any ideas/suggestions (or preferably solutions) would be most welcome
Jul 12 '07 #2
Top posting (to be consistent)

Bruce, I think this is definitetly the way to go. I've been sniffing the
data sent between the browser and the server, and I am missing the
fields you mentioned.
bruce barker wrote:
asp.net 1.1 used illegal names (so does asp.net 2.0, but its only the
breaking the first letter rule by using an "_", it replaced ":" with "$").

if this is a asp.net site, you need to also send the __VIEWSTATE with
the post. you can not hard code this. you must do a get, and parse the
html to get a valid _VIEWSTATE to send with the post. depending on how
the page was written, you may need to send _EVENTTARGET (say the login
is a link button).

-- bruce (sqlwork.com)

Grey Alien wrote:
>I am trying to programatically POST an ASP form, to allow me to log on
to a site programatically.

<form name="aspnetForm" method="post" action="Default.aspx"
id="aspnetForm">
<input name="_ct99:Content:UsrName" type="text"
id="_ct99_Content_UsrName" />
<input name="_ct99:Content:Pwd" type="password"
id="_ct99_Content_Pwd" />
<input type="submit" name="_ct99:Content:btnLogon" value="Logon"
id="_ct99_Content_btnLogon" />
<input id="_ct99_Content_SavePwd" type="checkbox"
name="_ct99:Content:SavePwd" /></p>
</form>
What I find strange/confusing is that the name attribute of the
elements (i.e. the controls) are not 'legal' (i.e. they contain colons
etc).

I need the 'name'='value' pairs to use in the POST.

I am using an external library (cURL) to do the POST action, so far I
have failed to log on when using either the name attribute (looked
suspicious anyway), but I also failed to log on when I used the id
attribute.

The "problem" definitely lies with this ASP.Net page, since I have
successfully logged on other pages using the post method.

Any ideas/suggestions (or preferably solutions) would be most welcome
Jul 12 '07 #3

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

Similar topics

2
by: TJ Talluto | last post by:
Hi, I'm using the curl functions in php to scrape the wan ip address from my home router (the router is an SMC product). This is a two step process: 1. post the password value to the login.htm...
3
by: Scott M | last post by:
Hi, I am currently trying to write a simple game using vb.net the form I am working on is 800*600 (this is set as the maximum size) and autoscroll is set to true. The user moves around the...
2
by: Astra | last post by:
Hi All I know I may sound like an IE waif, but I am trying to get my web sites to be more compatible especially with browsers such as Netscape, Safari, Mozilla, etc. In a nutshell, could...
1
by: M- | last post by:
Is it possible to position a Web Form control within a Panel ... programattically? That is, by adding lines to the following code: protected System.Web.UI.WebControls.Panel Panel1; private...
0
by: spamfurnace | last post by:
Hi there on this rainy old day, I have some users logging into an asp.net website. The server the site sits on allows users to webmail through a common service/component called Horde. In order...
0
by: Scott M | last post by:
Hi, I am currently trying to write a simple game using vb.net the form I am working on is 800*600 (this is set as the maximum size) and autoscroll is set to true. The user moves around the...
2
by: Norman Peelman | last post by:
From: "Norman Peelman" <npeelman@cfl.rr.com> Subject: Re: posting form data to two php scripts at once Date: Sunday, December 17, 2006 12:06 AM <one.1more@gmail.comwrote in message...
1
by: Grey Alien | last post by:
Apologies for the cross post. I am quite desperate and do not know which ng would be the most appropriate. I am trying to programatically POST an ASP form, to allow me to log on to a site...
0
by: hikmaverick | last post by:
Hi all, the title of my topic is a copy from an old message posted by Grey Allen, about twenty days ago. As Grey, I am trying to programatically POST an ASP form, to allow me to log on to a site...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
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...
0
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...

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.