Connection to SQL Server

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Graeme

    #1

    Connection to SQL Server

    I want to have an ASP.Net application to connect to a SQL Server database.

    I can’t use Active Directories or Windows authentication (network
    security!). So I want to use Forms authentication to allow the user to enter
    their SQL Server username and password, check their permissions (from a
    table), and then add them to a SQL Server Application Role. I want to use
    the SQL Server Application role to simplify the management of permissions
    with SQL Server.

    I can set up the authentication in the dotnet application.
    I can access the user passwords.
    I can run the sp_addapprole stored procedure to add a user to the
    application role.

    But I can’t maintain the connection to SQL Server (and application role)
    when I change pages within the application.

    Any suggestions?
  • rodneybauer1

    #2
    RE: Connection to SQL Server

    I'm just learning this stuff, but I recall reading about "session state" and
    "view state" being able to deal with what you want to do. the msdn library
    should have samples

    "Graeme" wrote:
    [color=blue]
    > I want to have an ASP.Net application to connect to a SQL Server database.
    >
    > I can’t use Active Directories or Windows authentication (network
    > security!). So I want to use Forms authentication to allow the user to enter
    > their SQL Server username and password, check their permissions (from a
    > table), and then add them to a SQL Server Application Role. I want to use
    > the SQL Server Application role to simplify the management of permissions
    > with SQL Server.
    >
    > I can set up the authentication in the dotnet application.
    > I can access the user passwords.
    > I can run the sp_addapprole stored procedure to add a user to the
    > application role.
    >
    > But I can’t maintain the connection to SQL Server (and application role)
    > when I change pages within the application.
    >
    > Any suggestions?[/color]

    Comment

    • Brendan Green

      #3
      Re: Connection to SQL Server

      Well, HTTP is a stateless protocol, meaning that each subsequent page
      request does not know anything about any prior requests.

      What you need to do is establish a connection to the SQL server on each page
      request.

      "rodneybaue r1" <rodneybauer1@d iscussions.micr osoft.com> wrote in message
      news:157A5750-910B-4A5F-A06D-A17E3858C79E@mi crosoft.com...[color=blue]
      > I'm just learning this stuff, but I recall reading about "session state"
      > and
      > "view state" being able to deal with what you want to do. the msdn library
      > should have samples
      >
      > "Graeme" wrote:
      >[color=green]
      >> I want to have an ASP.Net application to connect to a SQL Server
      >> database.
      >>
      >> I can't use Active Directories or Windows authentication (network
      >> security!). So I want to use Forms authentication to allow the user to
      >> enter
      >> their SQL Server username and password, check their permissions (from a
      >> table), and then add them to a SQL Server Application Role. I want to
      >> use
      >> the SQL Server Application role to simplify the management of permissions
      >> with SQL Server.
      >>
      >> I can set up the authentication in the dotnet application.
      >> I can access the user passwords.
      >> I can run the sp_addapprole stored procedure to add a user to the
      >> application role.
      >>
      >> But I can't maintain the connection to SQL Server (and application role)
      >> when I change pages within the application.
      >>
      >> Any suggestions?[/color][/color]


      Comment

      • Cor Ligthert

        #4
        Re: Connection to SQL Server

        Graeme,

        Yo can set information between pages and between the sent and get postedback
        state in a session.

        Session.Item["User"] = theUser;
        and than in the otherpage
        theUser = Session.Item["User"]

        I hope this helps,

        Cor


        Comment

        Working...