Hi,
I attached a FinishingUploadEventHandler on my controller. In that event, I plan to use the Username to rename the file. HttpContext.Current.User is null when this method is called. I'm using Windows Forms Authentication, and there is a valid user logged in. The User is populated correctly with all other server calls I do. What's the best way to get the username in the FinishingUploadEventHandler event?
Thanks,
Paul
Another approach is to use ASP.NET machinery to decrypt the cookie : http://ingeniarius.net/blog/infragistics-ignite-ui-upload-httpcontext-user-is-null/
Thanks for the link, we actually found an easier way to do this. Request.ServerVariables["LOGON_USER"] is populated with the username. In debug, either controller.Request.ServerVariables["AUTH_USER"] is populated or User.Identity.Name. Here is the code we use:
string userName = (controller.Request.ServerVariables.HasKeys()) ? controller.Request.ServerVariables["LOGON_USER"] : controller.User.Identity.Name; #if DEBUG userName = (controller.Request.ServerVariables.HasKeys()) ? controller.Request.ServerVariables["AUTH_USER"] : controller.User.Identity.Name; #endif