1. Trang chủ >
  2. Công Nghệ Thông Tin >
  3. Quản trị Web >

In the Review Summary window, click Finish and, when the process is complete, click Close. Log in to SQL Server with SQL Server Management Studio Express, as shown in Figure 22-6.

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (9.81 MB, 435 trang )


Listing 22-1 continued
Dim wi As System.Security.Principal.WindowsIdentity = _ System.Security.Principal.WindowsIdentity.GetCurrent
Response.Write“Account: “ wi.Name “br ” Catch exc As Exception
Response.Writeexc.Message “br ” End Try
Response.Write“Web root: “ Server.MapPath“~” “br ” Response.Write“Server name: “ _
Request.ServerVariables“SERVER_NAME” “br ” Response.Write _
System.Threading.Thread.CurrentThread. _ CurrentCulture.Name “: “ _
System.Threading.Thread.CurrentThread. _ CurrentCulture.EnglishName “br ”
End Sub script
Precompile If You’re Code Shy
If it bothers you that someone might rummage around on the Web server and read your source code, consider precompiling the site. Normally, ASP.NET
compiles the code the first time someone requests a page. With precompila- tion, ASP.NET puts the code from the .aspx, .asmx, .ascx, and .vb files
into a few assemblies .dll files in the bin folder. Follow these steps to compile your Web project:
1. Open your project in Visual Web Developer and build the site Build➪ Build Web Site to see any errors or warnings that need attention
View➪Error List.
Precompilation fails if the project has errors, so fix or exclude trouble- some pages.

2. Open a command prompt in the directory where aspnet_compiler.


exe
is installed. Try C:\\WINDOWS\\Microsoft.NET\\Framework\\
v2.0.50727
. 3. At the command prompt, enter the following command, replacing
c:\\site\\kjopc
with the path to your Web files: aspnet_compiler -v myweb -p c:\\site\\kjopc c:\\deploy
The preceding command compiles and then copies the required files including images and other static content into a new c:\\deploy
folder. The compiled files appear in the bin folder.
376
Part VI: The Part of Tens
Although the .aspx files copy to the c:\\deploy folder, no code or markup is in them — just the warning text: This is a marker file generated
by the precompilation tool, and should not be deleted
Deploy the contents of the c:\\deploy folder knowing that your code and markup are stored in binary compiled files. Without adding obfuscation,
probing and recovering the source code from .NET assemblies is quite easy with decompilation tools, such as Reflector.
Encrypt Connection Information
ASP.NET doesn’t serve display certain types of files to the browser, includ- ing configuration files. However, don’t tempt fate by flashing a SQL Server
password in the web.config file. Follow these steps to encrypt the connec- tion strings in the web.config file:

1. Open a command prompt and change to the directory where aspnet_


regiis.exe is stored. Try C:\\WINDOWS\\Microsoft.NET\\
Framework\\v2.0.50727 .
2. Enter the following command, replacing “c:\\deploy” with your deployment folder:
aspnet_regiis -pef “connectionStrings” “c:\\deploy”
The tool adds several nodes to the connectionStrings element, such as EncryptedData and CipherValue. Your secrets are somewhere
within all those nonsense characters and harder to decipher than the DaVinci code — except by ASP.NET
This command decrypts the section: aspnet_regiis -pdf “connectionStrings” “c:\\deploy”
377
Chapter 22: Ten Tips on Deploying Your Web Application

Xem Thêm
Tải bản đầy đủ (.pdf) (435 trang)

Tài liệu bạn tìm kiếm đã sẵn sàng tải về

Tải bản đầy đủ ngay
×