views:

74

answers:

2

H

Regarding this URL

http://www.codeproject.com/KB/aspnet/FlashUpload.aspx

User.Identity as System.Web.Security.FormsIdentity is always null, because the Identity is GenericIdentity, I assumed it will be as in the tutorial FormsIdentity, what is chances.

Thanks

A: 

This is the problem with Flash, and it has nothing to do with your server side code and here is why.

When Flash makes web service calls, http service calls to the same domain it came from, it regains cookies and in turn the each calls are made within your session (ASP.NET Session), but when you upload something flash does not send cookie (A bug reported to adobe with no response till date).

This is the reason FormsIdentity is null, because ASP.NET Server needs cookie in order to assign FormsIdentity to properly authenticated user request.

Thats why when you upload, you will never get the session, the work around this is, we pass a custom authentication hash in querystring that we can validate on the server side.

Akash Kava
And this is what I am trying to do, so I will send the ticket to the flash application through JS object and it back as query string decrypt it and then creates the authentication, but I found that in a page not related to Flash Upload that my Identity is Generic not Form, I don't get it sense I did not create that part of the application.
Tony
Are you using Flash's upload fuctionality via FileReference?
Akash Kava
A: 

Rather than Casting to FormsAuthentication, Simply get the cookie .ASPXAUTH (or the name specified in the web.config) and send it to flash and then let flash put it as a POST variable while uploading, then Read Request.Forms[POSTVariable] and create the FormsAuthenticationTickt as illustrated by the tutorial in the question.

Tony