http - Single sign-on not working correctly using different application pools? -


i have found out creating 2 new websites under iis 7 single sign-on authentication doesn't work when run in different application pools. when move applications same pool can login on 1 of them , logged in on other one. when change application pool on 1 of them, don't logged in on second one.

is there settings can set in machine.config file allow them share same cookie on application pools?


ex. 1: proj1 (app pool .net 2)

proj2 (app pool .net 2)

= single sign-on works, sharing same auth cookie.


ex. 2: proj1 (app pool .net 2)

proj2 (app pool .net 4, integrated/classic)

= single sign-on not work, not sharing same auth cookie.


ex. 2: proj1 (app pool .net 4, integrated/classic)

proj2 (app pool .net 4, integrated/classic)

= single sign-on works, sharing same auth cookie.


original post

latest update @ bottom

i have 2 projects, 1 asp.net webforms , other mvc 3 project.

i followed guide, see @ bottom, , got working on computer. when upload server, doesn't work anymore. differences can think of is, 1) on server using ssl, 2) webforms project using .net 2 , mvc project using .net 4 (integrated mode) , 3) use iis 7 on server , use vs 2008/2010 test on local machine.

asp.net mvc 3 (.net 4)

<forms name=".aspxauth" loginurl="~/home/login" timeout="30" enablecrossappredirects="true" domain=".mydomain.com" ticketcompatibilitymode="framework20" /> 

webforms (.net 2)

<forms name=".aspxauth" loginurl="default.aspx" defaulturl="default.aspx" timeout="30" domain=".mydomain.com" enablecrossappredirects="true" /> 

the funny part is, uploaded test.aspx page both mvc (.net 4) , webforms (.net) project , displays trace.

both projects have same sessionid , .aspxauth. on localhost can access aspxauth on mvc project can't access on server.

the projects run subdomains, mvc.mydomain.com , webforms.mydomain.com.

anyone got ideas on how solve this? have full access iis 7.0.

(i have tried turning ssl on server off still same result)

guide authentication sharing: http://www.codeproject.com/kb/aspnet/singlesignon.aspx

updated tried this: (webforms .net 2.0)

var ticket = new formsauthenticationticket(1, "authtest", datetime.now, datetime.now.addminutes(30), false, login.email); var enc = formsauthentication.encrypt(ticket); var cookie = new httpcookie("authcookie", enc) {domain = ".mydomain.com"}; response.cookies.add(cookie); 

and in mvc 3 (.net 4)

formsauthenticationticket ticket = formsauthentication.decrypt(httpcontext.request.cookies["authcookie"].value); viewbag.user = "user: " + ticket.name; 

this throws following error: "length of data decrypt invalid."

updated 6th jul

funny! when add 2 new domains runs under .net 2 works perfectly. when change application pool .net 4 stops working. aren't compatible or might missing setting somewhere

i think have set machinekey in web.config of both application same value. can generate machinekey section here: http://aspnetresources.com/tools/machinekey


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -