Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 3 of 3

Thread: re-using the connection string in the web.config for new development

  1. #1
    GoodFella is offline Member
    Join Date
    Mar 2009
    Posts
    99

    Default re-using the connection string in the web.config for new development

    I am creating a custom ASPX page with a connection to the SQL Server Database. Is there a way to re-use the existing ASPDNSF connection or do I need to create a new connection string in the web.config file?

    I am a little concerned of having an un-encrypted password in the web.config file.
    Last edited by GoodFella; 07-31-2009 at 08:19 PM. Reason: resolved

  2. #2
    MelanieA is offline Junior Member
    Join Date
    Sep 2008
    Posts
    313

    Default

    You need to have an unencrypted web.config first and copy all the connection strings indicated on your web.config file, that if you are going to use the same database you are having. If you will use a new database, you may simple create a new web.config file for your new site and indicate your connection strings.

  3. #3
    George the Great is offline Senior Member
    Join Date
    Nov 2006
    Location
    Cleveland, OH
    Posts
    1,792

    Default

    Is the .aspx page on the same site? If so, just add
    Code:
    using AspDotNetStorefrontCore;
    to the top of the file. Then you can create and use a sql connection by doing something like
    Code:
    using(SqlConnection conn = new SqlConnection(DB.GetDBConn()))
    {
       conn.Open();
       
       // your logic would go here doing whatever you needed to do with the connection
    
       conn.Close();
    }
    <a href="http://www.aspdotnetstorefront.com">Shopping Cart Software</a>