开发者

flex - SWFLoader - authentication

开发者 https://www.devze.com 2022-12-23 23:37 出处:网络
I have an issue where I am trying to load an external SWF using a SWFLoader, but the HTTP server requires authentication.

I have an issue where I am trying to load an external SWF using a SWFLoader, but the HTTP server requires authentication.

<mx:SWFLoader s开发者_运维百科ource="assets/externalswf.swf"></mx:SWFLoader>

Is there any way to pass the credentials to the SWFLoader?


You can first make an http request to the server to authenticate by setting the authentication headers (e.g. username/password/token etc.) or passing auth info (forms), and if your authentication mechanism uses cookies you can then make the swfloader load the swf file by passing the auth cookies to the server. If your authentication mechanism uses an http parameter similar to a token, you can simply append the token to the swf url (after obtaining the token), e.g. source="assets/external.swf?token=123fea34d8c-45ac34e". Depending on what mechanism the http server uses for authentication, you'll have to tailor it to that.

I've tried both approaches mentioned above with asp.net membership provider to secure xml, swf files and it works great.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号