<script type="text/javascript" language="javascript">
function setCookie()
{
var path = '/', host = document.location.hostname;
document.cookie = 'random=' + Math.floor(Math.random()*11) + '; path=' + path + ( host ? '; domain=' + document.location.hostname : "" ) ;
}
function readCookie()
{
alert(document.cookie)
}
</script>
My life would be a lot simpler if I had an easy way to change aspsessionid****
to just sessionid
in my logs. Is there a quick way to do this ... in Windows? There must be a script, batchfile, command or something that I can run as a scheduled daily task on new logfiles. At times like this I wish I could program. Suggestions welcome please!
This code works if you want to get rid of all session cookies except the last one created:
There is no option (known or documented - available to the public) to change the name of aspsessionids (classic asp).
You can disable the session (ASP -> Session Properties -> Enable Session State: false) from IIS or by using the @ENABLESESSIONSTATE directive and move on with your own cookies served from asp (and not by JavaScript). But this is OK only if you don't need the session object in your application.
A better approach is to change these "strings" in log files using Regex (asp version is already presented by Anthony W Jones) or by .net (minimal simplified C# sample):
More about aspx and IIS
One option is to use a handler to remove headers.
Another option is to control everything in global.asax (code or compiled library) - covering the case you don't have access to IIS manager.
Remove (and/or add) headers:
Handle errors
The next step is to hide aspx.
Assume that we want our .aspx pages presented as .html This is answered here: What is the proper way to map .html to the ASP.NET pipeline in IIS7
Just take care to select the correct framework version. If you don't have access to IIS manager, then modify your web.config (presenting only what is needed for this task):
The above setting may differ to your pc, server etc. Having a testing environment with the same basic attributes (framework version, 32/64bit), make the change in your IIS and then check the generated entry in your web.config.
Allow me to make a joke. "Do you like this product?"
Thank you Frank, you made be plug some old disks and find things that were forgotten. I'm sorry for not having suggestions for classic ASP.
PS. Don't forget the answer by HackedByChinese.
The answer to the bounty description is: "not really".
The only thing you can do is stop using session object altogether and disable sessions. You would therefore you need to create your own session management (storing data in a DB for example) and track your own sessions with a cookie.
The following is an answer to the original (now quite old question).
Here is a VBScript function which will replace the ASPSessionIDxxxxxxxx= in a log file (I'm assuming the standard IIS logfiles with cookie logging enabled).
If you are using .NET 2.0 or greater, you can change the cookie name via web.config.