How to install aspnet_regsql.exe to store session state data

Prachi 20 Reputation points
2023-01-12T10:47:06.2066667+00:00

Hi, I am trying to install session state on a SQL server instance, but whenever I'm trying to install it from command prompt I'm getting a login failed exception but I'm able to log into SSMS tool with the same credentials. I'm using SQL server authentication to login with a database name.I only have access to a particular database in the server and I want to use that database to create the required tables and stores procedures which are required to store session data. I can't get the access to create a new database in the server. What command do I need to write to install session state in the existing database rather than creating a new ASPState database? Thanks in advance.

Windows for business Windows Server User experience Other
SQL Server Other
0 comments No comments
{count} votes

Accepted answer
  1. Bruce (SqlWork.com) 77,686 Reputation points Volunteer Moderator
    2023-01-12T17:11:34.6633333+00:00

    use the -d <database> switch to use an existing database. the login will need still permissions to create the tables and props.

    if you want more flexibility. create a local database. then create a database project and reverse engineer. you can then use dpac to deploy.

    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Bruce (SqlWork.com) 77,686 Reputation points Volunteer Moderator
    2023-01-12T17:11:55.3266667+00:00

    duplicate post

    0 comments No comments

  2. LiHongMSFT-4306 31,566 Reputation points
    2023-01-13T06:27:02.7233333+00:00

    Hi @Prachi

    Here are two similar threads you may refer to:

    Can I store Session state in my ASP.NET MVC app's existing SQL Azure DB?

    SQL Session state server in own database

    Best regards,

    Cosmog Hong


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our Documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.