There is no way to set this in SharePoint. It's hard coded.
I've had pretty good luck with the code below. An issue still remains if you are using blobcaching on your WFE's. The blobcache module actually returns early and my code never gets hit.
public void Init(HttpApplication context)
{
context.PreRequestHandlerExecute += new EventHandler(context_PreRequestHandlerExecute);
context.PostAuthenticateRequest += new EventHandler(context_PostAuthenticateRequest);
}
void context_PostAuthenticateRequest(object sender, EventArgs e)
{
HttpApplication app = sender as HttpApplication;
RemoveCookie(app);
}
void context_PreRequestHandlerExecute(object sender, EventArgs e)
{
HttpApplication app = sender as HttpApplication;
RemoveCookie(app);
}
void RemoveCookie(HttpApplication app)
{
if (app == null) return;
if (app.Response == null) return;
if (app.Response.Cookies == null) return;
try
{
if (app.Response.Cookies["WSS_KeepSessionAuthenticated"] != null)
{
app.Response.Cookies["WSS_KeepSessionAuthenticated"].Expires = DateTime.Now.AddDays(-1D);
}
if (app.Response.Cookies["MSOWebPartPage_AnonymousAccessCookie"] != null)
{
app.Response.Cookies["MSOWebPartPage_AnonymousAccessCookie"].Expires = DateTime.Now.AddDays(-1D);
}
}
catch { }
}