• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2237
  • Last Modified:

Cross session problem

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.
0
Dharaniravindran
Asked:
Dharaniravindran
  • 2
  • 2
1 Solution
 
existenz2Commented:
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: http://msdn2.microsoft.com/en-us/library/hdxfb6cy.aspx . 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.
0
 
DharaniravindranAuthor Commented:
Yes, the user is getting a wrong information on the screen with different user details. But my question is, how to stop it?
0
 
existenz2Commented:
Have a look at this url: http://msdn2.microsoft.com/en-us/library/5ecf4420.aspx

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=" +
            HttpContext.Current.User.Identity.Name;
    }
    return base.GetVaryByCustomString(context, arg);
}

That will ensure caching per user.
0
 
DharaniravindranAuthor Commented:
Hey! Thanks man, it is working now.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now