asp.net - How to fix forms authentication with 51degrees detection library? -
i have existing asp.net mvc app uses custom forms-based authentication, creating formsauthenticationticket , writing auth cookie per example @ http://msdn.microsoft.com/en-us/library/system.web.security.formsauthenticationticket(v=vs.110).aspx.
now, when add reference 51degrees mobile device detection framework, i'm stuck in auth loop, context.request.isauthenticated permanently reporting false.
i've tracked down fact context.request.browser.cookies reporting false, explains why auth cookie isn't having effect. cause library think desktop browser (chrome in case, if makes difference) didn't support cookies? bug in detection library? misconfiguration or code error on end? else?
i upgraded 51degrees v3 using nuget , ran same problem.
you correct - context.request.browser.cookies
false authentication cookie doesn't set , if 1 there doesn't read. tried manually setting using formsauthentication.getauthcookie()
followed response.cookies.add()
, still didn't work.
i think it's bug in 51degrees library. have solution.
according msdn, formsauthentication.cookiessupported
relies on formsauthentication.cookiemode
property, relies on <forms cookieless="">
attribute.
by default, if <form>
cookieless
property not set, defaults usedeviceprofile
, 51degrees reports false
forms authentication not @ or set cookie.
manually setting <form cookieless="usecookies">
forces formsauthentication.cookiessupported
true, auth cookie set , read.
i tried , authentication works again.
--edit--: <sessionstate>
system.web element has cookieless
attribute. it's set usecookies
default that's why session state using session cookie still works. source: http://msdn.microsoft.com/en-us/library/h6bb9cz9(v=vs.100).aspx
Comments
Post a Comment