Cross session problem

Posted on 2007-08-10
Last Modified: 2013-11-07
Hi All,
We are facing a problem with cross session, due to implementation of OutputCaching. i.e., when a user is logged in our web site, the user's session is changed to some other user. If we remove OutputCaching for the application, it is working fine.
We are using dotnet framework 2.0, IIS 6.0, windows server 2003, SQL Server 2005.
We tried by using <httpRuntime enableKernelOutputCache="false"  /> in web.config as adviced by msdn. But it is not solving the problem. Please try to help us solving this problem. Thanks in advance.
Question by:Dharaniravindran
    LVL 14

    Expert Comment

    Most likely the output is cached by url and not by user. If you change the output cache to by user your problem should be solved.

    Have a look at: . The session can't be switched to another user. Caching and Session are two complete seperated types, so I doubt the session is changed because of output caching. Most likely the user is getting the wrong information on the screen, because previously the page from another user was cached.

    Author Comment

    Yes, the user is getting a wrong information on the screen with different user details. But my question is, how to stop it?
    LVL 14

    Accepted Solution

    Have a look at this url:

    Use this method in the global.asax (From the above page, you also want to change the arg name):

    public override string GetVaryByCustomString(HttpContext context,
        string arg)
        if(arg == "usercache")
            return "Cache=" +
        return base.GetVaryByCustomString(context, arg);

    That will ensure caching per user.

    Author Comment

    Hey! Thanks man, it is working now.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
    If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now