Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Create and remove session from two URLs one with WWW and other one. #7169


User avatar
0
huntethan89 created

Hi, I have published my website on IIS which is working in two ways. we can access the website using https://www.websitename.com and https://websitename.com. So, when logging in i am facing issue of session creation. If i logged in through one of the URL it is accessible to another URL due to session issue.

So, to resolve this i added cookie domain value in Startup.cs file in my project as follows, which is working fine. But when i click logout button, i am not able to logout.

app.UseCookieAuthentication(new CookieAuthenticationOptions
            {
                AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
                LoginPath = new PathString("/Account/Login"),
                CookieDomain = ".websitename.com"
            });

Is there any workaround to resolve this issue.

Thanks


4 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    i am not able to logout.

    Can you talk about it in detail?

  • User Avatar
    0
    huntethan89 created

    Actually i added a code to redirect to welcome page if user is already logged in. So, that user don't have to go to login screen everytiem. Now, when i click on logout it redirect me again to welcome page like cookies are not cleared.

  • User Avatar
    0
    maliming created
    Support Team

    Please share the code you wrote.

  • User Avatar
    0
    huntethan89 created

    Hi,

    I have completed this by removing cookies from domain which i added. Now its working fine.

    Thanks.