If I use asp.net to connect SQL 2008, what account should create in SQL server?

  • If I use asp.net to connect SQL 2008, what account should create in SQL server?

  • I don't understand your question. Can you please clarify? Are you asking which sql server should you use to connect to your database?

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

  • Sorry, my question is:

    Should I nedd to create a special account in SQL server in order for ASP.NET to connect database?

  • create a new login, for example "WebAccess", then add a user to the database the web pages will access.

    create a role for the appropriate rights,a nd finallly , put WebAccess in that role.

    here's a basic example

    -- add specific users

    IF NOT EXISTS (SELECT * FROM MASTER.dbo.syslogins WHERE name = N'WebAccess')

    BEGIN

    EXEC MASTER.dbo.sp_addlogin @loginame = N'WebAccess', @passwd = 'NotARealPassword', @defdb = N'WHATEVER', @deflanguage = N'us_english'

    --add this user to permit read and write

    END

    USE [WHATEVER]

    --make a user in the db for the matching login

    CREATE USER [WebAccess] FOR LOGIN [WebAccess]

    --create the Role for my web pages

    CREATE ROLE [StandardWebAccess]

    EXEC sp_addrolemember N'StandardWebAccess','db_datareader'

    EXEC sp_addrolemember N'StandardWebAccess','db_datawriter'

    GRANT EXECUTE TO [StandardWebAccess]

    --add these logs to the role

    EXEC sp_addrolemember N'StandardWebAccess', N'WebAccess'

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

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

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