Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting Up SQL Server Session Database

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!

like image 540
RailRhoad Avatar asked Dec 10 '25 12:12

RailRhoad


1 Answers

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:

  1. Create your own script files by coping the two template files.
  2. Create a name for your database (such as MyASPStateDB).
  3. In your own script files, replace all occurrences of DatabaseNamePlaceHolder with the name of your database.
  4. Install and remove ASP.NET session state SQL objects by using your own script files.

See full article here

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

like image 194
Dostee Avatar answered Dec 13 '25 00:12

Dostee



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!