0

(I'm scripting in Windows, for use in a Windows 7 gadget) Hi there, I'm trying to log in to a page on a server machine from a client machine using a ServerXMLHTTP request. I'm wondering if there's a way to fill in the input fields in the server's input fields and then making the server run the authorization on the information, and return the new URL. However, right now the main question I have is how would I go about logging in? Also, I tried passing the log in information in as parameters and it didn't seem to work out very well.

this.requests[1].open("POST", "https://" + this.address, true);
this.requests[1].setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
this.requests[1].send("username=user&password=pass");
Alexander Bird
  • 38,679
  • 42
  • 124
  • 159
user535617
  • 634
  • 2
  • 7
  • 22
  • A what? A "ServerXMLHTTP request"? Don't you mean `XMLHttpRequest`? And what's the value of `this.address`? Does it contain the same domain name as the page is on? – Marcel Korpel Dec 20 '10 at 20:04
  • ServerXMLHTTP request is effectively a Microsoft-specific version of XMLHttpRequest but it has some extra functionality. And this script in a Windows 7 gadget so no this.address does not contain the same domain name, but it's still accessible. – user535617 Dec 20 '10 at 20:10
  • 2
    If you are doing Windows scripting, make sure to mention in the question. By default most people will assume javascript questions are about it running in a browser – Ruan Mendes Dec 20 '10 at 20:18
  • specifically what language is this? some .NET language I'm assuming... – Alexander Bird Dec 20 '10 at 21:05
  • As it says in the title, it's Javascript. Windows 7 Gadgets are made with HTML and I'm using Javascript with the HTML. – user535617 Dec 20 '10 at 21:07

1 Answers1

0

according to http://it.toolbox.com/wiki/index.php/Sending_ServerXMLHTTP_login_credentials it looks like the username and password are the 4th and 5th parameters respectivly in the open function. So...

this.requests[1].open("post","https://"+this.address, true, "user_name", "p4ssword");
Alexander Bird
  • 38,679
  • 42
  • 124
  • 159