Remote website login via ASP code

Posted on 2009-02-20
Medium Priority
Last Modified: 2012-05-06
I have inherited an old ASP 2.0 application that remotely logs in to a paid subscription website and then retrieves data for processing, basically impersonating actions that would otherwise be done with a browser.  The target website has recently upgraded their site and is using ASP.NET.   The "name" tags for the login form (and other form fields) are all changed and appear to be dynamically generated.  I don't know ASP.NET but it appears that these form fields were created using some sort of ASP.NET handler.  My login routine no longer works as it seems the "name" attributes that I'm passing in aren't being recognized.  Here's the section of the target sites login form:
<input name="ctl00$ContentPlaceHolder1$SectionLogin1$Username" type="text" id="ctl00_ContentPlaceHolder1_SectionLogin1_Username" />
<p class="text-Smaller-Bold" align="center">
    Password:<br />
    <input name="ctl00$ContentPlaceHolder1$SectionLogin1$Password"
I've tried passing the following and neither has worked:

      oHttp.Open "POST","http://www.SomeWebSite.com/Recruiter/Default.aspx",False
      oHttp.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"

      oHttp.Send "Username=MYUSERNAME&Password=MYPASSWORD"

oHttp.Send "ctl00$ContentPlaceHolder1$SectionLogin1$Username=MYUSERNAME&ctl00$ContentPlaceHolder1$SectionLogin1$Password=MYPASSWORD"

Any assistance would be greatly appreciated.


Question by:emilysam
LVL 15

Accepted Solution

aibusinesssolutions earned 2000 total points
ID: 23694949
If they are using asp.net, one of the security features of asp.net is to prevent post backs to a form from a remote source.

The ID ctl00$ContentPlaceHolder1$SectionLogin1$Username specifies the location of the Username textbox.

ctl00 = aspnetForm
ContentPlaceHolder1 = Content section of MasterPage
SectionLogin1 = Custom User Control
Username = ID of the TextBox

The way asp.net would handle that is __doPostBack('ctl00$ContentPlaceHolder1$SectionLogin1$Username',''), which would POST several things, including an __EVENTTARGET and __VIEWSTATE.  

I don't think you will be able to do what you are wanting to do, unless that website explicetly has something on their login page to allow remote logins.

Author Comment

ID: 23700130
that's what I was afraid of and it makes sense as these sites typically don't want automated searches unless it's through an interface they provide.  Thanks for the input.  I'll hold the question open for a couple of days to see if there are other ideas.

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Planning to migrate your EDB file(s) to a new or an existing Outlook PST file? This video will guide you how to convert EDB file(s) to PST. Besides this, it also describes, how one can easily search any item(s) from multiple folders or mailboxes…
Is your organization moving toward a cloud and mobile-first environment? In this transition, your IT department will encounter many challenges, such as navigating how to: Deploy new applications and services to a growing team Accommodate employee…
Suggested Courses
Course of the Month6 days, 10 hours left to enroll

592 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question