Connecting ASP.NET to SQL Server Application Roles

Discussion in 'ASP .Net Security' started by Graeme, May 19, 2005.

  1. Graeme

    Graeme Guest

    I'm trying to connect an ASP.NET to a SQL Server application role but can't
    find how to keep the connection between pages.

    My initial page asks the user for their SQL Server username and logon.

    I then do the following:

    Create a connection string using the user's logon and password;
    Create a new sqlclient.sqlconnection object using this string.
    Create a new SqlClient.SqlCommand object.
    Open the connection using the command.
    If it opens ok, use the executenonquery command to execute the sp_addapprole
    stored procedure on SQL Server (sending the applicaion role and application
    role password);
    Transfer control to a webform page.

    How do I keep the connection when I transfer to the new page?

    Graeme
     
    Graeme, May 19, 2005
    #1
    1. Advertising

  2. Graeme

    Sin Min Guest

    Hi!

    Before you move to the next page, I believe you have closed the connection
    (best practise to close every connection after use). You then have to open
    the connection again in your 2nd page if data access is required.


    Regards,
    Sin Min

    "Graeme" wrote:

    > I'm trying to connect an ASP.NET to a SQL Server application role but can't
    > find how to keep the connection between pages.
    >
    > My initial page asks the user for their SQL Server username and logon.
    >
    > I then do the following:
    >
    > Create a connection string using the user's logon and password;
    > Create a new sqlclient.sqlconnection object using this string.
    > Create a new SqlClient.SqlCommand object.
    > Open the connection using the command.
    > If it opens ok, use the executenonquery command to execute the sp_addapprole
    > stored procedure on SQL Server (sending the applicaion role and application
    > role password);
    > Transfer control to a webform page.
    >
    > How do I keep the connection when I transfer to the new page?
    >
    > Graeme
    >
     
    Sin Min, May 27, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ashish M Bhonkiya
    Replies:
    0
    Views:
    453
    Ashish M Bhonkiya
    May 5, 2004
  2. Peri
    Replies:
    1
    Views:
    410
    Patrick Olurotimi Ige
    Jun 13, 2005
  3. Luqman
    Replies:
    1
    Views:
    466
    Cowboy \(Gregory A. Beamer\)
    Nov 24, 2006
  4. Jéjé
    Replies:
    0
    Views:
    248
    Jéjé
    Sep 27, 2005
  5. Luqman
    Replies:
    1
    Views:
    111
    Brad Kingsley
    Dec 7, 2006
Loading...

Share This Page