C # tracking the settings file

Source: Internet
Author: User

Many people on the internet asked the location where the settings file was stored. I read some articles and didn't give a clear answer. So let's track where the settings file is stored together, whether encryption protection exists.

Settings is the setting file, which is similar to the app. config file, but compared to the app. the config settings structure is relatively simple. It has only four attributes: name, type, range, and value, and cannot change the structure (of course, in general cases, if you want to modify the structure, you can use other methods)

We all know that after the app. config file is generated or debug, the corresponding directory application file name .exe. config (window program) will exist)

The problem is that the project's pro. settings cannot find the corresponding file after compilation.

Modify the settings in the program code. The Code is as follows:
LoginSet. Default. IsSaveLog = true;
LoginSet. Default. LogName = "testUser ";
LoginSet. Default. LogPassWord = "test ";
LoginSet. Default. IpAddress = "127.0.0.1 ";
LoginSet. Default. Save ();
LoginSet. Default. IsSaveLog = true;
LoginSet. Default. LogName = "testUser ";
LoginSet. Default. LogPassWord = "test ";
LoginSet. Default. IpAddress = "127.0.0.1 ";
LoginSet. Default. Save ();

The test values defined in advance are modified in the program. After the program is closed, the setting value is successfully changed and the settings are stored on the disk.

Start searching for its location->

It is certain that the settings file is not stored in the directory of the execution program, so it is estimated that it is stored in the temporary directory of the system disk.

Perform a simple test: copy a copy of the execution program to another directory, and then run the test. The original setting value is returned to the initial state. This table is related to the Application Path and the copy program, it does not conflict with the settings setting file of the original program and can be used independently.

The whereabouts are found. Find the file name of your executable program in the C: Documents and Settings directory of the system disk and find this file, user. Config

Open the file as follows:
<? Xml version = "1.0" encoding = "UTF-8"?>
<Configuration>
<UserSettings>
<Test. LoginSet>
<Setting name = "IsSaveLog" serializeAs = "String">
<Value> True </value>
</Setting>
<Setting name = "LogName" serializeAs = "String">
<Value> testName </value>
</Setting>
<Setting name = "LogPassWord" serializeAs = "String">
<Value> apace </value>
</Setting>
<Setting name = "IpAddress" serializeAs = "String">
<Value> 127.0.0.1 </value>
</Setting>
</Test. LoginSet>
</UserSettings>
</Configuration>
<? Xml version = "1.0" encoding = "UTF-8"?>
<Configuration>
<UserSettings>
<Test. LoginSet>
<Setting name = "IsSaveLog" serializeAs = "String">
<Value> True </value>
</Setting>
<Setting name = "LogName" serializeAs = "String">
<Value> testName </value>
</Setting>
<Setting name = "LogPassWord" serializeAs = "String">
<Value> apace </value>
</Setting>
<Setting name = "IpAddress" serializeAs = "String">
<Value> 127.0.0.1 </value>
</Setting>
</Test. LoginSet>
</UserSettings>
</Configuration>

Find the file we need to find.

Conclusion: The findings of this document draw a conclusion ,.. Net will copy a copy to the temporary directory of the current user when the program is running. The directory name at zero time is uncertain, but the previous part can be determined. My default directory is: C: documents and SettingsAdministratorLocal SettingsApplication Data ???? \ Test.exe _ Url_hgfoy0r3bz1vyaqbme2dl1uefmet0wso1.0.0.0

C: Documents and SettingsAdministratorLocal SettingsApplication Data, which is fixed, but varies according to different user administrators.

???? Is my system version

Test.exe Application name

Url_hgfoy0r3bz1vyaqbme2dl1uefmet0wso the Code is based on the MD5 code value generated by your application.

1.0.0.0 indicates the program version.

Related Article

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.