Flash sendAndLoad with HTTP BASIC Authentication

Posted on 2005-05-02
Last Modified: 2008-01-09

I am trying to figure out how to use Flash's sendAndLoad feature with a webpage that resides in a password protected directory.

Currently when I try to access the page directly from a browser, the browser prompts me with a username and password.

When I try to do a sendAndLoad from Flash to this same page, flash opens the same type of dialog box and i can type my password in and everything works, life goes on.

My question is how can i prefill the password so flash does not prompt me for one. In this case the username and password will always be 'admin'.

I've tried a few things such as formatting the URL like this:

but flash says it's not a valid URL.

I basically want to add my own headers to the HTTP call but I snooped some of the headers Firefox was sending and it does not send them in plaintext.

The only header that is added after i type the password is:
Authorization: Basic YWRtaW46YWRtaW4=

^Does that somehow relate to admin/admin?

I also looked up the LoadVars2 class which supports some form of user/pass but i could not get it working.

Is there another way to do this?

Maximum points to whoever can come up with a solution for me as soon as possible. Thanks!!
Question by:Aurora_Multimedia
    LVL 5

    Expert Comment


    I don't have a web server available at the moment where I can test this, but here's a suggestion...

    Use JavaScript to POST nothing to the ASP page, first. You can do this by writing your own JavaScript code to respond to an fscommand. In the JS code, you can use the admin:admin style URL.

    After the JS code is called, put a brief delay in your Flash movie then call the SendAndLoad. The connection should persist.

    Let me know how it goes. I should be in the office on Wednesday and I can test this as well.

    Best of luck...

    LVL 37

    Expert Comment

    Something along this sort of line, I guess...

    Author Comment

    The javascript hack might work if this was a flash that was going to be on a webpage, however This will be in a Flash .EXE projector.

    (I have to make it a .exe so I can use flash studio pro's functions.)
    LVL 37

    Expert Comment

    I know you will get good help from the MDM people...  
    They are really good at their stuff, and they should be able to give you some good solution...  ;)

    Author Comment

    I tried this with no success:

    this["upgradeIT"+currentipAddress].addRequestHeader("Authorization", "Basic YWRtaW46YWRtaW4=");
    LVL 27

    Accepted Solution

    Have you just tried it with a projector created with flash studio?
    To me this code, tested in an html page, or inside flash authoring, or on a swf alone, doesn't work:

    data.sendAndLoad("http://admin:admin@localhost/secure/file.asp", data, "POST");

    but do works if testes in a flash studio projector...

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Training Course: Adobe Dreamweaver CC 2015

    Adobe Dreamweaver Creative Cloud is used by web designers and front-end developers and allows you to visualize your site in real-time as you code. This course covers exam objectives for the Adobe Certified Associate (ACA) certification.

    Suggested Solutions

    Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
    This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
    The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.
    This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

    737 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

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now