Link to home
Start Free TrialLog in
Avatar of Aurora_Multimedia
Aurora_Multimedia

asked on

Flash sendAndLoad with HTTP BASIC Authentication

Hello,

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:
http://admin:admin@192.168.1.1/secure/file.asp

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!!
Avatar of DavidCrossman
DavidCrossman

Aurora,

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...

David
-=-
Something along this sort of line, I guess...  
http://javascript.internet.com/navigation/htaccess-login.html
Avatar of Aurora_Multimedia

ASKER

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.)
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...  ;)
I tried this with no success:

this["upgradeIT"+currentipAddress].addRequestHeader("Authorization", "Basic YWRtaW46YWRtaW4=");
ASKER CERTIFIED SOLUTION
Avatar of negatyve
negatyve

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial