DemoUserAuthorization icon indicating copy to clipboard operation
DemoUserAuthorization copied to clipboard

Request.Headers.Authorization is null.

Open yys0124 opened this issue 10 years ago • 2 comments

int the method "OnActionExecuting", Request.Headers.Authorization is always null, I don't know how to set it and I find you setting the code "ticString " [string ticString = FormsAuthentication.Encrypt(ticket);] into cookie.

yys0124 avatar Jun 18 '14 06:06 yys0124

Hi, in my project, I use ajax to make a web request in browser side, so I use cookie to storage the encrypted authorization. Maybe it's better to use web local storage when HTML5 is a choice.

There is a sample code to set authorization in web request header, hope it's a tip for you.

request.Headers.Add("Authorization", "BASIC " + "encrypted authorization..." );
//you need to package your authorization info here.

I think the popular solution is HMAC, you can get more if you search in google,

besley avatar Jun 19 '14 01:06 besley

I was able to do it. thanks for your reply.

yys0124 avatar Jun 19 '14 01:06 yys0124