Skip navigation
Currently Being Moderated

The HTTP request header Date cannot be set via ActionScript.

Aug 29, 2012 3:44 AM

Tags: #as3 #flex-builder #as3.0 #actionscrip

Hi All,

 

I'm trying to pass urlrequest binding with "Date", "Authorization" to amazon s3 from flex 4.5 web application. However it's failed to connect and throws error as,

 

Error #2096: The HTTP request header Date cannot be set via ActionScript.

 

So, please tell me what i need to use or which flash player supports to add "Date" in header request.

 
Replies
  • kglad
    62,194 posts
    Jul 21, 2002
    Currently Being Moderated
    Aug 29, 2012 6:26 AM   in reply to grace-glory

    are you using a query string appended to your http request?  if so, copy and paste the request.

     
    |
    Mark as:
  • kglad
    62,194 posts
    Jul 21, 2002
    Currently Being Moderated
    Aug 29, 2012 1:57 PM   in reply to grace-glory

    where's getDateString?

     
    |
    Mark as:
  • kglad
    62,194 posts
    Jul 21, 2002
    Currently Being Moderated
    Aug 29, 2012 9:39 PM   in reply to grace-glory

    escape that return.

     

    and make sure your datetimeformatter has the correct params.  i believe DateTimeFormatter(LocaleID.DEFAULT, DateTimeStyle.LONG, DateTimeStyle.NONE) should work.

     
    |
    Mark as:
  • kglad
    62,194 posts
    Jul 21, 2002
    Currently Being Moderated
    Aug 29, 2012 10:13 PM   in reply to grace-glory

    use:

     

        private function getDateString(d:Date):String

            {

                /*var dd:Date = new Date(d.getUTCFullYear(), d.getUTCMonth(), d.getUTCDate(), d.getUTCHours(), d.getUTCMinutes(), d.getUTCSeconds(), d.getUTCMilliseconds());

                var ds:String = dateFormatter.format(dd);

                return ds + " GMT";*/

               

                var df:DateTimeFormatter = new DateTimeFormatter(LocaleID.DEFAULT, DateTimeStyle.LONG, DateTimeStyle.NONE);

                var sd:String = df.format(d);

                return escape(sd);

            }

     

    p.s. if you see an error message click "permit debugging" and paste the entire error message and indicate the first listed problematic line of code in from the error message.

     
    |
    Mark as:
  • kglad
    62,194 posts
    Jul 21, 2002
    Currently Being Moderated
    Aug 30, 2012 6:45 AM   in reply to grace-glory

    your code is difficult to read but it doesn't appear that error message is related to the discussion in this thread.

     

    in any case, if you want help with that click "permit debugging" and paste the entire error message and indicate the first listed problematic line of code in from the error message.

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 1, 2012 6:29 AM   in reply to grace-glory

    You cannot use Date and Authorization headers in Flash Player.

     

    Adobe clearly states it in the docs: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/fla sh/net/URLRequestHeader.html

     

     

    In Flash Player and in Adobe AIR content outside of the application security sandbox, the following request headers cannot be used, and the restricted terms are not case-sensitive (for example, Get, get, and GET are all not allowed). Also, hyphenated terms apply if an underscore character is used (for example, both Content-Length and Content_Length are not allowed):

     

    Accept-Charset, Accept-Encoding, Accept-Ranges, Age, Allow, Allowed, Authorization, Charge-To, Connect, Connection, Content-Length, Content-Location, Content-Range, Cookie, Date, Delete, ETag, Expect, Get, Head, Host, If-Modified-Since, Keep-Alive, Last-Modified, Location, Max-Forwards, Options, Origin, Post, Proxy-Authenticate, Proxy-Authorization, Proxy-Connection, Public, Put, Range, Referer, Request-Range, Retry-After, Server, TE, Trace, Trailer, Transfer-Encoding, Upgrade, URI, User-Agent, Vary, Via, Warning, WWW-Authenticate, x-flash-version.

     

    And there is no workaround.

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 15, 2012 6:36 AM   in reply to grace-glory

    Caan you explain how you resolve?

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points