asp.net - FormsAuthentication encrypt / decrypt -


i have 2 applications, 1 called www.domain.dk , m.domain.dk

both of them has login function (identical), if login on m.domain.dk , goes www.domain.dk needs remember have logged in.

and here comes problem..

www throws , error saying can't validate data cookie set m site, started debugging code , found out when www encrypting formsauthenticationticket, encrypted string 64 characters longer when m site it.

the following part web.config identical both projects

<machinekey validationkey="cf3d..." decryptionkey="a56..." validation="sha1" decryption="aes" />  <authentication mode="forms">   <forms name=".aspxauth" domain=".domain.dk" timeout="20" enablecrossappredirects="true" path="/" protection="all" cookieless="usecookies" /> </authentication> 

the following code login function

var ticket = new formsauthenticationticket(1, user.username, datetime.now, datetime.now.addminutes(20), false, string.empty, "/"); var hashcookies = formsauthentication.encrypt(ticket); 

www old site, question mainly, there other things can affect "formsauthentication.encrypt" other have in web.config?

the solution add

compatibilitymode="framework20sp1" 

to machinekey tag


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -