Set and read web. config

Source: Internet
Author: User
Tags connectionstrings
<? Xml version = "1.0" encoding = "UTF-8"?>
<! --
Note: In addition to manually editing this file, you can also use
Web management tools to configure application settings. You can use
"Website"-> "Asp. Net configuration" option.
The complete list of settings and comments is displayed in
In machine. config. comments, this file is usually located in
In WindowsMicrosoft. NetFrameworkv2.xConfig
-->
<Configuration>
<Deleetask>
<Add key = "WebSiteURL" value = "http://zwlyl.twtzw.com/"/>
</AppSettings>
<ConnectionStrings>
<Add name = "MySqlConnection" connectionString = "Data Source = localhost; Initial Catalog = database; User ID = sa; Password = 111111; Pooling = true"/>
</ConnectionStrings>
<System. web>
<! --
Set compilation debug = "true" to insert the debugging symbol
Compiled pages. However, this
Performance is affected, so this value is only available during development.
Set to true.
-->
<Compilation debug = "false"/>
<! --
In the <authentication> section, you can configure
Security Authentication mode,
To identify the user.
-->
<Authentication mode = "Windows"/>
<! --
If an unprocessed error occurs during request execution,
You can configure the corresponding processing steps in the <mermerrors> section. Specifically,
This section allows developers to configure
HTML error page to be displayed
To replace the error stack trace.

<Customerrors mode = "remoteonly" defaultredirect = "genericerrorpage.htm">
<Error statuscode = "403" Redirect = "noaccess.htm"/>
<Error statuscode = "404" Redirect = "filenotfound.htm"/>
</Customerrors>
-->
</System. Web>
</Configuration>
String connectionstring = convert. tostring (configurationmanager. connectionstrings ["mysqlconnection"]);
String websiteurl = convert. tostring (configurationmanager. receivettings ["websiteurl"]);

 

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.