Read the second Setting Parameter in Web. config.

Source: Internet
Author: User

The Web. config parameters are as follows:

<Configuration>
<Connectionstrings>
<! -- Database link string -->
<Add name = "connstring" connectionstring = "Server = (local); uid = sa; Pwd =; persist Security info = false; initial catalog = CSHARP; max pool size = 1000 "type =" regxph "text =" yourobjectname "/>
<Add name = "ImagePath" connectionstring = "http: // localhost/imageupload/"/>
</Connectionstrings>
</Configuration>

 

InProgramYou can read each string using the following method:

 

String cs_sqlstring = system. configuration. configurationmanager. connectionstrings ["connstring"]. tostring ();

String cs_imgstring = system. configuration. configurationmanager. connectionstrings ["ImagePath"]. tostring ();

Note: 1. Add system. Configuration references to the program.

2. Windows trusted authentication connection string:

Conectionstring = "Data Source =.; initial catalog = northwind; Integrated Security = sspi ;";

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.