简体   繁体   中英

how to store connection string in dll / class library

I want to store a connection string in my dll. I created a class library to store connection string. How to pass this connection string value to web.config file? Or how to get this value in another project?

public class Class1
{
    public string encrypt()
    {
        string connection = @"Server=SYSTEM-6\SQLEXPRESS;Database=devleadsdb;Integrated Security=True;";
        return connection;
    }
}

You can use a class library to embed an encryption and decryption algorithm. Then use that class to read and write encrypted connection string to connectionStrings xml section on web/app.config. Refer this library to your main project.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM