Create a website project in ASP. NET. You cannot embed the sqlmap file into the resource for compilation. Therefore, you cannot encrypt the file. You can use another method to encrypt the file.
1. Create a coding class Library:
2. Create the properties. config file:
Code
<? XML version = " 1.0 " Encoding = " UTF-8 " ?>
< Settings >
<! -- User Application and configured property settings go here. -->
<! -- Example: < Add key = " Settingname " Value = " Settingvalue " /> -->
< Add key = " Connectionstring " Value = " Data Source = dbname; user id = sa; Password = sa " />
</ Settings >
Right-click the property and embed it into the resource. After compilation, set coding. DLL to the bin folder of the website project.
3. Configure sqlmap:
Code
<? XML version = " 1.0 " Encoding = " UTF-8 " ?>
< Sqlmapconfig xmlns = " Http://ibatis.apache.org/dataMapper " Xmlns: xsi = " Http://www.w3.org/2001/XMLSchema-instance " >
< Properties embedded = " Properties. config, coding " />
< Settings >
< Setting usestatementnamespaces = " True " />
< Setting cachemodelsenabled = " False " />
</ Settings >
<Providers Resource="Providers. config"/>
< Database >
< Provider name = " Oracleclient1.0 " />
< Datasource name = " Documentsystem " Connectionstring = " $ {Connectionstring} " />
<! -- < Datasource name = " Global " Connectionstring = " Data Source =; user id =; Password = " /> -->
</ Database >
Note:
Code
<Properties embedded="Properties. config, coding"/>
Make sure to configure it in this form. Otherwise, after IIS is restarted, the site will fail to find embedded resources and an error will occur. This completes the encryption.