#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2011
    Posts
    3
    Rep Power
    0

    Login to 3rd party site (was Iframe Passthrame)


    I would appreaciate if you could give me a hand in this javascript in the codebehind of a C# asp.net page. What I want to do is have a button, which when pressed will do the following:

    1. create a frame or iframe or something like that

    2. go to page within that frame

    3. login to that page by focusing on specific form elements and then submiting the form

    4. Redirect to that logged in page

    Here is what I have managed until now:

    Code:
    <iframe id="logonframe" src="https://.com" style="width: 100%; height: 200px; border:none;"></iframe>
    
                  <script language=Javascript>
                      function paybutton() 
                  {
                          document.domain = "https://.com";
                          var oIframe = document.getElementById("logonframe");
                          var oDoc = oIframe.contentWindow || oIframe.contentDocument;
                          if (oDoc.document) {
                              oDoc = oDoc.document;
                          }
                          oDoc.getElementById("logonButton").click();
                          oDoc.parent.login.logonForm.f_username.value = 'xxxl@quer.co.uk';
                          oDoc.parent.login.logonForm.f_passwd.value = 'zzz';
                          oDoc.parent.login.logonForm.submit();
                          return true; 
                  }
                   </script>
    
                  <input type="button" value="my javascript" onclick="javascript:paybutton()" style="float:left;" />
  2. #2
  3. No Profile Picture
    Lost in code
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 2004
    Posts
    8,316
    Rep Power
    7170
    Browsers won't allow you to manipulate the contents of a frame unless it is on the same domain as the parent page.
    PHP FAQ

    Originally Posted by Spad
    Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2011
    Posts
    3
    Rep Power
    0
    Originally Posted by E-Oreo
    Browsers won't allow you to manipulate the contents of a frame unless it is on the same domain as the parent page.
    Thanks for your reply. Can you suggest any other way of doing what I need to do?
  6. #4
  7. No Profile Picture
    Lost in code
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 2004
    Posts
    8,316
    Rep Power
    7170
    Using asp.net/JavaScript there is no way for you to log in the user on a third party site. You would need to be able to execute privileged code, like signed Java, Flash or a browser extension to be able to do something like that.

    If you have some control over the third party site then you could program an API that would allow you to do this.

    If the site has a "GET" form that allows the user to log in then you could use that instead. If you set the iframe URL directly to that then you'll log them in immediately.
    PHP FAQ

    Originally Posted by Spad
    Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2011
    Posts
    3
    Rep Power
    0
    Thanks, can you give me any advice on how to go about realising this in Flash? Will it be just a actionscript running in the background through an embedded swf video module - which would be the button?

    Originally Posted by E-Oreo
    Using asp.net/JavaScript there is no way for you to log in the user on a third party site. You would need to be able to execute privileged code, like signed Java, Flash or a browser extension to be able to do something like that.

    If you have some control over the third party site then you could program an API that would allow you to do this.

    If the site has a "GET" form that allows the user to log in then you could use that instead. If you set the iframe URL directly to that then you'll log them in immediately.
  10. #6
  11. No Profile Picture
    Lost in code
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 2004
    Posts
    8,316
    Rep Power
    7170
    I really have no idea, I've never programmed anything in Flash. I asked a moderator to move your thread to the Flash board.
    PHP FAQ

    Originally Posted by Spad
    Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around

IMN logo majestic logo threadwatch logo seochat tools logo