0

I've built a small ASP.NET mvc app with Forms Authentication. I don't seem to be able to share cookies/authentication from the base domain(say people.com) to subdomain (abc.people.com) What I mean is when i Debug through the code the Request.Cookies object doesn't have any and User.Identity.IsAuthenticated is false.

What's even weird is it seems to work fine for Internet Explorer (weird huh .. ?) But for Chrome and Firefox.

But when i check the browser for cookies, I can see that the cookie is existent for the domain people.com

Am i missing something very obvious ??

Edit: I'm using OAuthWebSecurity to Login. The code that logs in is this

 OAuthWebSecurity.Login(result.Provider, result.ProviderUserId, createPersistentCookie: true);

And the web.config value is

<authentication mode="Forms">
  <forms loginUrl="~/Account" timeout="2880" />
</authentication>
noob Mama
  • 267
  • 8
  • 28
  • Without seeing the code you have that writes the cookie its difficult to help, however the following Stackoverflow post may help [Share cookies across domains](https://stackoverflow.com/a/7591730/968633) – AdamWhite Mar 04 '13 at 18:05
  • thanks, for the quick reply, I've updated the question with the code that does the Log-in – noob Mama Mar 04 '13 at 18:09
  • It seems to work on all browsers once I set the domain attribute in web.config authentication element to people.com – noob Mama Mar 04 '13 at 18:37
  • you could post the same as an answer I'll accept, I'd not have tried it if it weren't for your link – noob Mama Mar 04 '13 at 18:39
  • Ah glad you've managed to work it, why not post your own answer to your question detailing the fix you made so others can use this as a reference. – AdamWhite Mar 04 '13 at 19:40

1 Answers1

0

Adding domain attribute to forms filed, with base domain value seemed to have fixed the problem.

    <authentication mode="Forms">
    <forms loginUrl="~/Account" 
         timeout="2880"
         domain="people.com"
         />
noob Mama
  • 267
  • 8
  • 28