I notice that the sql to create the SQL server database (InstallPersistSqlState.sql) basically creates the database ASPState. If I wanted to name that different, can I just replace that with my prefered database name? I understand the script, I just wanted to make sure that ASPState didn't have to be the database name. Thanks!
edit - Here is a hopeful bit of instructions to change the default object the session tables are written to:
Use the templates files to install the ASP.NET session state SQL objects on a database other than the default ASPState database. To do this, follow these steps:
- Create your own script files by coping the two template files.
- Create a name for your database (such as MyASPStateDB).
- In your own script files, replace all occurrences of DatabaseNamePlaceHolder with the name of your database.
- Install and remove ASP.NET session state SQL objects by using your own script files.
The InstallPersistSqlState.Sql script just puts the sessions into a table named ASPState instead of the other method of InstallSqlState.sql which would add sessions to a temporary table (which would have some volatility risks with a system restart). After looking at the script it doesn't appear that 'ASPState' is anything more than an arbitrary name for the table- however, a test run is probably the best way to actually verify that.
Some good reading on Session States and the Install Scripts above
I would imagine you can change the name to something else if you wanted to. If you change the name of the database after it's already created, make sure the job that references that DB references the correct name that you chose or else the job might fail when trying to clean out expired session data. You will also probably need to specify the "initial catalog" value in your web.config SqlState connection string also. I don't know for sure, but I would guess that if ASP.NET does not find an Initial Catalog value in that connection string, it uses 'ASPState' by default.