create user login n password for a database inside a project in asp.net 2.0

  • hi everybody,

    i just got stuck in one problem and therefore want help.........

    I am working in a website with a database in sql server 2005. Database is created and working fine. No problem in this till now.

    Problem is -->> this database is created using Windows Authentication. I want to switch over to SQL Server Authentication. The database is currently residing inside App_Data folder inside the project.

    How to create a new user login and password for this database.

    I am using C# Asp.Net 2.0 and Sql Server 2005.

    Desperately waiting for an early reply.

    Thanks and regards.

    Suneet

  • I am not sure you can remove Windows authentication however you can use both Windows and SQL authentication which will let you create SQL authentication user. You do that in SMS make authentication both. You should know Asp.net 2.0 and above comes with User membership database that lets you configure users. If you are interested in that go to the location below and run aspnet_regsql. Why all you have to do is add users the database and the Web Admin tool will do all the work for you.

    C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727

    Kind regards,
    Gift Peddie

  • Hi there,

    Thanks for the reply. You asked why to add users for the database. Actually this database is linked with the website and is residing in the Asp_Data folder which is a part of this webiste project and is being developed using C# Asp.Net 2.0 and database ms sql server 2005.

    If I donot put a login and password for the database and simply publish it on the net then anybody can access the database and misuse the company's information.

    If I create and use database seperately using "Sql Server Managament Studio" then here there is a provision for creating a new user login which can be done by right clicking the database and from "Tasks" create new userlogin and password.

    But here the database is created inside Asp.Net using Server Explorer. There is a provision to create a database only, not user login and password. I therefore stuck in this problem how to create new user login and password for this database only. So that whenever anybody tries to access database, he/she has to provide proper login and password first for that database only.

    Hope now you may have understood my problem.

    Thanks and regards,

    Suneet Pant

  • The App_Data folder was created for the database I told you to use, you could also run that wizard on your existing database so the Asp.net membership will do all the work for you. But you can still change your SQL Server authentication to both Windows and SQL so you can use SQL permissions for your users. I am assuming you know Asp.net is also a user so the Networks service account needs permissions in that database and SQL login.

    Kind regards,
    Gift Peddie

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply