1. Trang chủ
  2. » Công Nghệ Thông Tin

Tài liệu ASP.NET 1.1 Insider Solutions- P11 pptx

50 274 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Cấu trúc

  • cover.pdf

  • page_r1.pdf

  • page_r2.pdf

  • page_r3.pdf

  • page_r4.pdf

  • page_r5.pdf

  • page_r6.pdf

  • page_r7.pdf

  • page_r8.pdf

  • page_r9.pdf

  • page_r10.pdf

  • page_r11.pdf

  • page_r12.pdf

  • page_1.pdf

  • page_2.pdf

  • page_3.pdf

  • page_4.pdf

  • page_5.pdf

  • page_6.pdf

  • page_7.pdf

  • page_8.pdf

  • page_9.pdf

  • page_10.pdf

  • page_11.pdf

  • page_12.pdf

  • page_13.pdf

  • page_14.pdf

  • page_15.pdf

  • page_16.pdf

  • page_17.pdf

  • page_18.pdf

  • page_19.pdf

  • page_20.pdf

  • page_21.pdf

  • page_22.pdf

  • page_23.pdf

  • page_24.pdf

  • page_25.pdf

  • page_26.pdf

  • page_27.pdf

  • page_28.pdf

  • page_29.pdf

  • page_30.pdf

  • page_31.pdf

  • page_32.pdf

  • page_33.pdf

  • page_34.pdf

  • page_35.pdf

  • page_36.pdf

  • page_37.pdf

  • page_38.pdf

  • page_39.pdf

  • page_40.pdf

  • page_41.pdf

  • page_42.pdf

  • page_43.pdf

  • page_44.pdf

  • page_45.pdf

  • page_46.pdf

  • page_47.pdf

  • page_48.pdf

  • page_49.pdf

  • page_50.pdf

  • page_51.pdf

  • page_52.pdf

  • page_53.pdf

  • page_54.pdf

  • page_55.pdf

  • page_56.pdf

  • page_57.pdf

  • page_58.pdf

  • page_59.pdf

  • page_60.pdf

  • page_61.pdf

  • page_62.pdf

  • page_63.pdf

  • page_64.pdf

  • page_65.pdf

  • page_66.pdf

  • page_67.pdf

  • page_68.pdf

  • page_69.pdf

  • page_70.pdf

  • page_71.pdf

  • page_72.pdf

  • page_73.pdf

  • page_74.pdf

  • page_75.pdf

  • page_76.pdf

  • page_77.pdf

  • page_78.pdf

  • page_79.pdf

  • page_80.pdf

  • page_81.pdf

  • page_82.pdf

  • page_83.pdf

  • page_84.pdf

  • page_85.pdf

  • page_86.pdf

  • page_87.pdf

  • page_88.pdf

  • page_89.pdf

  • page_90.pdf

  • page_91.pdf

  • page_92.pdf

  • page_93.pdf

  • page_94.pdf

  • page_95.pdf

  • page_96.pdf

  • page_97.pdf

  • page_98.pdf

  • page_99.pdf

  • page_100.pdf

  • page_101.pdf

  • page_102.pdf

  • page_103.pdf

  • page_104.pdf

  • page_105.pdf

  • page_106.pdf

  • page_107.pdf

  • page_108.pdf

  • page_109.pdf

  • page_110.pdf

  • page_111.pdf

  • page_112.pdf

  • page_113.pdf

  • page_114.pdf

  • page_115.pdf

  • page_116.pdf

  • page_117.pdf

  • page_118.pdf

  • page_119.pdf

  • page_120.pdf

  • page_121.pdf

  • page_122.pdf

  • page_123.pdf

  • page_124.pdf

  • page_125.pdf

  • page_126.pdf

  • page_127.pdf

  • page_128.pdf

  • page_129.pdf

  • page_130.pdf

  • page_131.pdf

  • page_132.pdf

  • page_133.pdf

  • page_134.pdf

  • page_135.pdf

  • page_136.pdf

  • page_137.pdf

  • page_138.pdf

  • page_139.pdf

  • page_140.pdf

  • page_141.pdf

  • page_142.pdf

  • page_143.pdf

  • page_144.pdf

  • page_145.pdf

  • page_146.pdf

  • page_147.pdf

  • page_148.pdf

  • page_149.pdf

  • page_150.pdf

  • page_151.pdf

  • page_152.pdf

  • page_153.pdf

  • page_154.pdf

  • page_155.pdf

  • page_156.pdf

  • page_157.pdf

  • page_158.pdf

  • page_159.pdf

  • page_160.pdf

  • page_161.pdf

  • page_162.pdf

  • page_163.pdf

  • page_164.pdf

  • page_165.pdf

  • page_166.pdf

  • page_167.pdf

  • page_168.pdf

  • page_169.pdf

  • page_170.pdf

  • page_171.pdf

  • page_172.pdf

  • page_173.pdf

  • page_174.pdf

  • page_175.pdf

  • page_176.pdf

  • page_177.pdf

  • page_178.pdf

  • page_179.pdf

  • page_180.pdf

  • page_181.pdf

  • page_182.pdf

  • page_183.pdf

  • page_184.pdf

  • page_185.pdf

  • page_186.pdf

  • page_187.pdf

  • page_188.pdf

  • page_189.pdf

  • page_190.pdf

  • page_191.pdf

  • page_192.pdf

  • page_193.pdf

  • page_194.pdf

  • page_195.pdf

  • page_196.pdf

  • page_197.pdf

  • page_198.pdf

  • page_199.pdf

  • page_200.pdf

  • page_201.pdf

  • page_202.pdf

  • page_203.pdf

  • page_204.pdf

  • page_205.pdf

  • page_206.pdf

  • page_207.pdf

  • page_208.pdf

  • page_209.pdf

  • page_210.pdf

  • page_211.pdf

  • page_212.pdf

  • page_213.pdf

  • page_214.pdf

  • page_215.pdf

  • page_216.pdf

  • page_217.pdf

  • page_218.pdf

  • page_219.pdf

  • page_220.pdf

  • page_221.pdf

  • page_222.pdf

  • page_223.pdf

  • page_224.pdf

  • page_225.pdf

  • page_226.pdf

  • page_227.pdf

  • page_228.pdf

  • page_229.pdf

  • page_230.pdf

  • page_231.pdf

  • page_232.pdf

  • page_233.pdf

  • page_234.pdf

  • page_235.pdf

  • page_236.pdf

  • page_237.pdf

  • page_238.pdf

  • page_239.pdf

  • page_240.pdf

  • page_241.pdf

  • page_242.pdf

  • page_243.pdf

  • page_244.pdf

  • page_245.pdf

  • page_246.pdf

  • page_247.pdf

  • page_248.pdf

  • page_249.pdf

  • page_250.pdf

  • page_251.pdf

  • page_252.pdf

  • page_253.pdf

  • page_254.pdf

  • page_255.pdf

  • page_256.pdf

  • page_257.pdf

  • page_258.pdf

  • page_259.pdf

  • page_260.pdf

  • page_261.pdf

  • page_262.pdf

  • page_263.pdf

  • page_264.pdf

  • page_265.pdf

  • page_266.pdf

  • page_267.pdf

  • page_268.pdf

  • page_269.pdf

  • page_270.pdf

  • page_271.pdf

  • page_272.pdf

  • page_273.pdf

  • page_274.pdf

  • page_275.pdf

  • page_276.pdf

  • page_277.pdf

  • page_278.pdf

  • page_279.pdf

  • page_280.pdf

  • page_281.pdf

  • page_282.pdf

  • page_283.pdf

  • page_284.pdf

  • page_285.pdf

  • page_286.pdf

  • page_287.pdf

  • page_288.pdf

  • page_289.pdf

  • page_290.pdf

  • page_291.pdf

  • page_292.pdf

  • page_293.pdf

  • page_294.pdf

  • page_295.pdf

  • page_296.pdf

  • page_297.pdf

  • page_298.pdf

  • page_299.pdf

  • page_300.pdf

  • page_301.pdf

  • page_302.pdf

  • page_303.pdf

  • page_304.pdf

  • page_305.pdf

  • page_306.pdf

  • page_307.pdf

  • page_308.pdf

  • page_309.pdf

  • page_310.pdf

  • page_311.pdf

  • page_312.pdf

  • page_313.pdf

  • page_314.pdf

  • page_315.pdf

  • page_316.pdf

  • page_317.pdf

  • page_318.pdf

  • page_319.pdf

  • page_320.pdf

  • page_321.pdf

  • page_322.pdf

  • page_323.pdf

  • page_324.pdf

  • page_325.pdf

  • page_326.pdf

  • page_327.pdf

  • page_328.pdf

  • page_329.pdf

  • page_330.pdf

  • page_331.pdf

  • page_332.pdf

  • page_333.pdf

  • page_334.pdf

  • page_335.pdf

  • page_336.pdf

  • page_337.pdf

  • page_338.pdf

  • page_339.pdf

  • page_340.pdf

  • page_341.pdf

  • page_342.pdf

  • page_343.pdf

  • page_344.pdf

  • page_345.pdf

  • page_346.pdf

  • page_347.pdf

  • page_348.pdf

  • page_349.pdf

  • page_350.pdf

  • page_351.pdf

  • page_352.pdf

  • page_353.pdf

  • page_354.pdf

  • page_355.pdf

  • page_356.pdf

  • page_357.pdf

  • page_358.pdf

  • page_359.pdf

  • page_360.pdf

  • page_361.pdf

  • page_362.pdf

  • page_363.pdf

  • page_364.pdf

  • page_365.pdf

  • page_366.pdf

  • page_367.pdf

  • page_368.pdf

  • page_369.pdf

  • page_370.pdf

  • page_371.pdf

  • page_372.pdf

  • page_373.pdf

  • page_374.pdf

  • page_375.pdf

  • page_376.pdf

  • page_377.pdf

  • page_378.pdf

  • page_379.pdf

  • page_380.pdf

  • page_381.pdf

  • page_382.pdf

  • page_383.pdf

  • page_384.pdf

  • page_385.pdf

  • page_386.pdf

  • page_387.pdf

  • page_388.pdf

  • page_389.pdf

  • page_390.pdf

  • page_391.pdf

  • page_392.pdf

  • page_393.pdf

  • page_394.pdf

  • page_395.pdf

  • page_396.pdf

  • page_397.pdf

  • page_398.pdf

  • page_399.pdf

  • page_400.pdf

  • page_401.pdf

  • page_402.pdf

  • page_403.pdf

  • page_404.pdf

  • page_405.pdf

  • page_406.pdf

  • page_407.pdf

  • page_408.pdf

  • page_409.pdf

  • page_410.pdf

  • page_411.pdf

  • page_412.pdf

  • page_413.pdf

  • page_414.pdf

  • page_415.pdf

  • page_416.pdf

  • page_417.pdf

  • page_418.pdf

  • page_419.pdf

  • page_420.pdf

  • page_421.pdf

  • page_422.pdf

  • page_423.pdf

  • page_424.pdf

  • page_425.pdf

  • page_426.pdf

  • page_427.pdf

  • page_428.pdf

  • page_429.pdf

  • page_430.pdf

  • page_431.pdf

  • page_432.pdf

  • page_433.pdf

  • page_434.pdf

  • page_435.pdf

  • page_436.pdf

  • page_437.pdf

  • page_438.pdf

  • page_439.pdf

  • page_440.pdf

  • page_441.pdf

  • page_442.pdf

  • page_443.pdf

  • page_444.pdf

  • page_445.pdf

  • page_446.pdf

  • page_447.pdf

  • page_448.pdf

  • page_449.pdf

  • page_450.pdf

  • page_451.pdf

  • page_452.pdf

  • page_453.pdf

  • page_454.pdf

  • page_455.pdf

  • page_456.pdf

  • page_457.pdf

  • page_458.pdf

  • page_459.pdf

  • page_460.pdf

  • page_461.pdf

  • page_462.pdf

  • page_463.pdf

  • page_464.pdf

  • page_465.pdf

  • page_466.pdf

  • page_467.pdf

  • page_468.pdf

  • page_469.pdf

  • page_470.pdf

  • page_471.pdf

  • page_472.pdf

  • page_473.pdf

  • page_474.pdf

  • page_475.pdf

  • page_476.pdf

  • page_477.pdf

  • page_478.pdf

  • page_479.pdf

  • page_480.pdf

  • page_481.pdf

  • page_482.pdf

  • page_483.pdf

  • page_484.pdf

  • page_485.pdf

  • page_486.pdf

  • page_487.pdf

  • page_488.pdf

  • page_489.pdf

  • page_490.pdf

  • page_491.pdf

  • page_492.pdf

  • page_493.pdf

  • page_494.pdf

  • page_495.pdf

  • page_496.pdf

  • page_497.pdf

  • page_498.pdf

  • page_499.pdf

  • page_500.pdf

  • page_501.pdf

  • page_502.pdf

  • page_503.pdf

  • page_504.pdf

  • page_505.pdf

  • page_506.pdf

  • page_507.pdf

  • page_508.pdf

  • page_509.pdf

  • page_510.pdf

  • page_511.pdf

  • page_512.pdf

  • page_513.pdf

  • page_514.pdf

  • page_515.pdf

  • page_516.pdf

  • page_517.pdf

  • page_518.pdf

  • page_519.pdf

  • page_520.pdf

  • page_521.pdf

  • page_522.pdf

  • page_523.pdf

  • page_524.pdf

  • page_525.pdf

  • page_526.pdf

  • page_527.pdf

  • page_528.pdf

  • page_529.pdf

  • page_530.pdf

  • page_531.pdf

  • page_532.pdf

  • page_533.pdf

  • page_534.pdf

  • page_535.pdf

  • page_536.pdf

  • page_537.pdf

  • page_538.pdf

  • page_539.pdf

  • page_540.pdf

  • page_541.pdf

  • page_542.pdf

  • page_543.pdf

  • page_544.pdf

  • page_545.pdf

  • page_546.pdf

  • page_547.pdf

  • page_548.pdf

  • page_549.pdf

  • page_550.pdf

  • page_551.pdf

  • page_552.pdf

  • page_553.pdf

  • page_554.pdf

  • page_555.pdf

  • page_556.pdf

  • page_557.pdf

  • page_558.pdf

  • page_559.pdf

  • page_560.pdf

  • page_561.pdf

  • page_562.pdf

  • page_563.pdf

  • page_564.pdf

  • page_565.pdf

  • page_566.pdf

  • page_567.pdf

  • page_568.pdf

  • page_569.pdf

  • page_570.pdf

  • page_571.pdf

  • page_572.pdf

  • page_573.pdf

  • page_574.pdf

  • page_575.pdf

  • page_576.pdf

  • page_577.pdf

  • page_578.pdf

  • page_579.pdf

  • page_580.pdf

  • page_581.pdf

  • page_582.pdf

  • page_583.pdf

  • page_584.pdf

  • page_585.pdf

  • page_586.pdf

  • page_587.pdf

  • page_588.pdf

  • page_589.pdf

  • page_590.pdf

  • page_591.pdf

  • page_592.pdf

  • page_593.pdf

  • page_594.pdf

  • page_595.pdf

  • page_596.pdf

  • page_597.pdf

  • page_598.pdf

  • page_599.pdf

  • page_600.pdf

  • page_601.pdf

  • page_602.pdf

  • page_603.pdf

  • page_604.pdf

Nội dung

The MMIT Mobile Controls In version 1.1 of the .NET Framework, the ASP.NET mobile controls from the MMIT are inte- grated into the class library and can be used directly, without requiring a separate installation. The two namespaces System.Web.Mobile (the core classes and authentication and error-handling features) and System.Web.UI.MobileControls (the controls themselves) are now an integral part of the .NET Framework. There is also a namespace System.Web.UI.MobileControls.Adapters , which contains the core control adapter classes that you can use to build you own mobile controls. By default, ASP.NET does not create pages that are suitable for use with the mobile controls, and you still have to add the same “extra information” to the page to use these controls. This involves specifying that the page itself should be an instance of the MobilePage type, which allows multiple forms to exist on a page and provides integration with the core mobile capabili- ties: <%@Page Inherits=”System.Web.UI.MobileControls.MobilePage” Language=”VB”%> You must also continue to specify the tag prefix and the assembly that contains the mobile controls by using a Register directive, so that the controls can be identified. The usual prefix is “mobile” , as in this example: <%@Register TagPrefix=”mobile” Namespace=”System.Web.UI.MobileControls” Assembly=”System.Web.Mobile”%> This means that existing version 1.0 pages that use the MMIT will function just the same on version 1.1, with no changes required to the code except where it uses other classes (for example, classes from the System.Data namespaces) that have changed in version 1.1. Running Version 1.1 Applications on Version 1.0 If you write an application to run on version 1.1 of the .NET Framework and avoid using any features that are new or changed in version 1.1, you will be able to run that application on version 1.0. However, unless you are strictly limited to using only version 1.0 on the server that will host the application, you should consider always running on the latest version of the .NET Framework to benefit from the latest security fixes and performance enhancements. How ASP.NET Selects the Runtime Version IIS uses the concept of mappings (sometimes called script mappings or application mappings) to decide how to process a file or resource when it is requested through the WWW Service. You can view and change the mappings for a Web site or a virtual Web application in the Mappings tab of the Application Configuration dialog for a Web site. To open the Application Configuration dialog, you open the Properties dialog for the Web site, select the Home Directory tab, and click the Configuration button (see Figure 12.4). 12 Side-by-Side Execution in ASP.NET 488 17 0672326744 CH12 5/4/04 12:25 PM Page 488 Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. 489 How to Specify the ASP.NET Version for Individual Applications The mappings for ASP.NET pages and resources point to the file aspnet_isapi.dll , which is responsible for processing these pages and resources. If you have more than one version of the .NET Framework installed, the mapping will point to the version of aspnet_isapi.dll that will be used, and this determines which version of the .NET Framework classes and ASP.NET runtime will process the resources. In Figure 12.4, you can see that version 1.1 will be used (the full version number is 1.1.4322). How to Specify the ASP.NET Version for Individual Applications As you have seen in the preceding section, all you have to do to force ASP.NET resources to be executed under a different version of the .NET Framework is change the mapping to point to aspnet_isapi.dll in the appropriate [version] folder of the .NET Framework. One way to do this is to manually edit the entries; however, you have to repeat this process for several file types (all the extensions for ASP.NET, such as .aspx , .asmx , .asax , and .ascx ). A far easier way to force ASP.NET resources to be executed under a different version of the .NET Framework is to use the aspnet_regiis.exe application registration utility that is provided with every version of the .NET Framework. This utility can be used for several tasks related to script mappings in IIS, including updating the mappings for some or all of the Web sites and Web applications configured within IIS. Installing ASP.NET Without Updating Script Mappings The Dotnetfx.exe setup program executes the aspnet_regiis.exe utility automatically when you install the .NET Framework and when you uninstall it. However, you can prevent aspnet_regiis.exe from being executed, and hence maintain the existing script mappings, by FIGURE 12.4 Viewing the script mappings in Internet Information Services Manager. 17 0672326744 CH12 5/4/04 12:25 PM Page 489 Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. running the Dotnetfx.exe setup program from a command window and specifying the special parameter sequence, as shown here: Dotnetfx.exe /c:”install /noaspupgrade” This means that you can install the latest version of ASP.NET without disturbing any existing applications and then update individual applications as and when required by using the aspnet_regiis.exe utility. When you create a new Web application, the version currently set up for the default Web site within which the new application is created is used for the new applica- tion until you specifically change it. Again, you can use the aspnet_regiis.exe utility for this. Remember that if the version of ASP.NET you are installing is older than the most recent version already installed, the setup program does not automatically execute aspnet_regiis.exe —and so the existing script mappings are not updated. Using the aspnet_regiis.exe Tool to Configure Runtime Versions The aspnet_regiis.exe tool is supplied with each version of the .NET Framework and is located in the %windir%/Microsoft.NET/Framework/[version]/ folder. The version of the tool is different for each version of the .NET Framework, so you must use the correct one, depending on what configuration changes you want to make. For example, to configure an application to use version 1.0 of the .NET Framework, you must run the version of aspnet_regiis.exe from the folder %windir%/Microsoft.NET/Framework/v1.0.3705/ . You run the aspnet_regiis.exe utility from a command window. As shown in Table 12.1, aspnet_regiis.exe accepts a range of parameters that determine the configuration changes it makes. Note that you can use this tool to create the aspnet_client folder for your Web sites and populate it with the required client-side script files, and you can also use it to set the script mappings or display information about the versions of ASP.NET that are installed. In Windows Server 2003, with IIS 6.0, you must also manage the Web service extensions to allow ASP.NET to serve pages. You’ll learn more on this topic later, but you can see in Table 12.1 that the aspnet_regiis.exe utility can set these for you as well. TABLE 12.1 The Command-Line Parameters for the aspnet_regiis.exe Utility Parameter Description -i Registers this version of ASP.NET, adds the matching Web service extension to IIS 6.0, and updates the mappings for all Web sites and Web applications to point to this version of aspnet_isapi.dll. -ir Registers this version of ASP.NET but does not update Web site and Web application mappings. -enable Is used with the -i or -ir parameters to set the status to Allowed for the Web service exten- sion it installs for ASP.NET (version 1.1 and above with IIS 6.0 and above only). -s <path> Updates the mappings for all Web sites and Web applications at the specified path and updates any applications nested within this path to point to this version of aspnet_isapi.dll (for example, aspnet_regiis.exe -s W3SVC/1/ROOT/ProAspNet). -sn <path> Updates the mappings for all Web sites and Web applications at the specified path, but not those nested within this path, to point to this version of aspnet_isapi.dll. 12 Side-by-Side Execution in ASP.NET 490 17 0672326744 CH12 5/4/04 12:25 PM Page 490 Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. 491 How to Specify the ASP.NET Version for Individual Applications -r Updates the mappings for all Web sites and Web applications configured within IIS to point to this version of aspnet_isapi.dll. Does not register this version of ASP.NET or add a Web service extension. -u Unregisters this version of ASP.NET and removes the Web service extension. Any existing mappings for this version are remapped to the highest remaining version of ASP.NET that is installed on the machine. -ua Unregisters all versions of ASP.NET on the machine. -k <path> Removes all mappings to all versions of ASP.NET for all Web sites and Web applications at the specified path and any applications nested within this path (for example, aspnet_regiis.exe -k W3SVC/1/ROOT/ProAspNet). -kn <path> Removes all mappings to all versions of ASP.NET from the specified path but does not remove those nested within this path. -lv Lists all versions of ASP.NET that are installed on the machine, along with the current status (Valid or Invalid) and path to aspnet_isapi.dll for that version (when the status is Valid). -lk Lists the paths of all the IIS metabase keys that contain ASP.NET mappings, together with the version each one is mapped to. Does not include any keys that inherit ASP.NET mappings from a parent key. -c Installs the client-side scripts for this version into the aspnet_client subfolder of every IIS Web site directory. -e Removes the client-side scripts for this version from the aspnet_client subfolder of every IIS Web site directory. -ea Removes the client-side scripts for all versions of ASP.NET from the aspnet_client subfolder of every IIS Web site directory. -? Prints the help text in the command window. One issue to be aware of is that installing the .NET Framework adds to your PATH environment variable the path to the utilities folder. Therefore, depending on the order in which you installed the .NET Framework versions, you might find that typing just aspnet_regiis will not run the version you expect or require. To get around this, you need to enter the full path to the version of aspnet_regiis.exe that you want or edit your PATH environment variable to change the order of the paths or add the one you need. To edit your PATH environment variable, you open the System applet by selecting Start, Settings, Control Panel; then you click the Environment Variables button in the Advanced tab of the System Properties dialog. Listing Versions, Web Sites, and Application Roots As an example of using aspnet_regiis , the following command uses the -lv (list versions) param- eter to list the versions of the .NET Framework that are installed on the machine by printing the path to the aspnet_isapi.dll file for each version and showing which is the default (root) entry in IIS: C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322>aspnet_regiis -lv 1.0.3705.0 Valid TABLE 12.1 Continued Parameter Description 17 0672326744 CH12 5/4/04 12:25 PM Page 491 Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. ➥ C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\aspnet_isapi.dll 1.1.4322.0 Valid (Root) ➥ C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll To get a list of the Web sites and virtual Web applications, together with the version that each one is currently mapped to, you can use the -lk (list keys) parameter: C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322>aspnet_regiis -lk W3SVC/ 1.1.4322.0 W3SVC/1/ROOT/ 1.1.4322.0 W3SVC/1/ROOT/MSMQ/ 1.1.4322.0 W3SVC/1/ROOT/Printers/ 1.1.4322.0 W3SVC/1/ROOT/ASPNETInsiders/ 1.1.4322.0 Updating the ASP.NET Runtime Configuration To demonstrate how to change the mappings for Web sites and Web applications, the following command shows how you can use the -s (script-map) parameter (the path can be obtained using the -lk parameter as shown in the preceding section): C:\WINDOWS\ \v1.0.3705>aspnet_regiis -s W3SVC/1/ROOT/ASPNETInsiders Start installing ASP.NET DLL (1.0.3705.0) ➥ recursively at W3SVC/1/ROOT/ASPNETInsiders Finished installing ASP.NET DLL (1.0.3705.0) ➥ recursively at W3SVC/1/ROOT/ASPNETInsiders Now the mappings for the virtual application root named ASPNETInsiders and all nested virtual applications are configured so that they will execute under version 1.0 of the .NET Framework. One point to watch here is that because IIS 6.0 was not available when version 1.0 of the .NET Framework was created, the aspnet_regiis tool does not install ASP.NET 1.0 in the Web service extensions section of IIS 6.0. You have to create this entry manually (as shown in the following section) and set the status to Allowed . Installing the ASP.NET Client-Side Script Folder When you create a new Web site, the aspnet_client subfolder that contains the client-side scripts required by some ASP.NET server controls is not automatically added to that Web site. You can ensure that it is present and correctly populated with the required scripts for all Web sites by using the -c option of aspnet_regiis.exe : C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322>aspnet_regiis -c ASP.NET and IIS 6.0 on Windows Server 2003 IIS 6.0 on Windows Server 2003 contains a new extra layer of security for the Web service, in the form of Web service extensions. Basically, Web service extensions are subsets of the script 12 Side-by-Side Execution in ASP.NET 492 17 0672326744 CH12 5/4/04 12:25 PM Page 492 Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. 493 ASP.NET and IIS 6.0 on Windows Server 2003 mappings that are installed on the machine, with the option to block requests for files that have the file extension specified in that mapping set. You have to ensure that the status for the Web service extension that specifies the version of ASP.NET you are using for your applications is set to Allowed . If it isn’t, the client will simply receive a “Page not found” response—even though the page exists and the user has requested the correct URL. IIS 6.0 Web Service Extensions To configure Web service extension settings in IIS 6.0, you open Internet Information Services Manager and select the Web Service Extensions folder. You can see in Figure 12.5 that the Web service extension for version 1.1 of ASP.NET is configured within the list and has its status set to Allowed so that it can handle requests. This is because this machine was specified as an applica- tion server when the Windows Server 2003 operating system was installed. FIGURE 12.5 Managing the Web service extensions in IIS 6.0 on Windows Server 2003. To add a new extension for a different version of the .NET Framework, you click the Add a New Web Service Extension link. Then you type the name of the extension in the New Web Service Extension dialog, check the option Set Extension Status to Allowed, and click the Add button. In the Add File dialog that appears, you navigate to the appropriate .NET Framework version folder and select the aspnet_isapi.dll file (see Figure 12.6). After you click OK twice, the new Web service extension appears in the list. Now any ASP.NET pages or resources that are configured to use this version of the .NET Framework—in other words, applications that specify this version of aspnet_isapi.dll in their script mappings—will run (see Figure 12.7). 17 0672326744 CH12 5/4/04 12:25 PM Page 493 Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. IIS 6.0 Application Pools If you try to run ASP.NET applications that are configured to use different versions of the .NET Framework on the same machine under Windows 2003 and IIS 6.0, you must either segregate them by version in different application pools or disable application pooling altogether and run in IIS 5.0 isolation mode (described later in this chapter, in the section “Using IIS 5.0 Isolation Mode in IIS 6.0”). By default, IIS 6.0 uses a common process for all the applications running in the same application pool. If applications in the same application pool try to use different versions of ASP.NET, you’ll see the Server Application Unavailable page and the error message shown in Figure 12.8 appears in the Application section of the event log. To get around this, you can create a new application pool and then assign the applications that require different versions of the .NET Framework to different pools. You can run all the applica- tions that use the same version of the .NET Framework in the same application pool, or you can create multiple application pools and allocate your applications between them. 12 Side-by-Side Execution in ASP.NET 494 FIGURE 12.6 Adding a new Web service extension. FIGURE 12.7 A new Web service extension in Internet Information Services Manager. 17 0672326744 CH12 5/4/04 12:25 PM Page 494 Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. 495 ASP.NET and IIS 6.0 on Windows Server 2003 Creating a New Application Pool To create a new application pool, you right-click the Application Pools folder in Internet Information Services Manager and select New; then you select Application Pool. Next, you enter the name for the new application pool in the Add New Application Pool dialog that appears, and you select the first option button to use the default settings. Alternatively, if you have created a template for application pools, you can base the new one on that by selecting the second option button (see Figure 12.9). FIGURE 12.8 The error messages when multiple versions of ASP.NET are not configured in separate application pools. FIGURE 12.9 Creating a new application pool in IIS 6.0. Allocating ASP.NET Applications to an Application Pool To assign a Web site or virtual Web application to an existing application pool, you just have to select it in the Properties dialog for the site or application. In the Home Directory tab or the Virtual Directory tab of the Properties dialog, you use the drop-down Application Pool list at the bottom of the dialog to specify which application pool you require (see Figure 12.10). 17 0672326744 CH12 5/4/04 12:25 PM Page 495 Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. Using IIS 5.0 Isolation Mode in IIS 6.0 You can configure IIS 6.0 to run in IIS 5.0 isolation mode. In this mode, the application-pooling feature that is turned on by default in IIS 6.0 is disabled, and applications run under the same process isolation model as in IIS 5.0. If you enable IIS 5.0 isolation mode, you can run ASP.NET applications that execute under different versions of the .NET Framework without having to create separate application pools. To enable IIS 5.0 isolation mode, you open the Properties dialog for the Web Sites folder and check the Run WWW Service in IIS 5.0 Isolation Mode option (see Figure 12.11). When you close the Properties dialog, IIS prompts you to restart the service to put the new setting into effect. 12 Side-by-Side Execution in ASP.NET 496 FIGURE 12.10 Selecting the application pool for an ASP.NET Web application. FIGURE 12.11 Specifying IIS 5.0 isolation mode in IIS 6.0. 17 0672326744 CH12 5/4/04 12:25 PM Page 496 Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. 497 Summary However, in IIS 5.0 isolation mode you do not benefit from many of the improvements in IIS 6.0, including better process management and deadlock detection. You should avoid using IIS 5.0 isolation mode unless it is absolutely necessary. Summary This chapter looks at how the .NET Framework allows you to run multiple versions side-by-side and select which version each application should run under. This is a huge advance over previ- ous versions of ASP, where you had to perform a full server upgrade and shift all your applica- tions to the newly installed version. Along with the fundamental changes that the .NET Framework provides, such as freedom from reliance on COM components and “DLL hell,” ASP.NET side-by-side execution also solves many issues you had to cope with in the past. In particular, running and testing different versions of your Web sites and Web applications are now much easier and much more controllable. You can move an application from one version of the .NET Framework to another quickly and easily. As well as side-by-side execution, this chapter also looks at the changes to the namespaces in the .NET Framework that are relevant to ASP.NET and Web applications. There are many minor changes between versions 1.0 and 1.1, and there are quite a lot of bug fixes, but only a few of these affect applications when you migrate from one version to another. This chapter summa- rizes the changes that are most likely to affect your applications and how you can get around the issues these changes raise. Finally, this chapter looks at the latest version of the Windows operating system, Windows Server 2003, and the way it affects ASP.NET applications. The better performance and robustness of IIS version 6.0 certainly make it worth considering an upgrade to Windows Server 2003. 17 0672326744 CH12 5/4/04 12:25 PM Page 497 Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. [...]... provided that those files are served by ASP.NET In order to bring a file type under the control of ASP.NET and thus forms authentication—you need to do two things: n Map the file type to ASP.NET in Internet Information Services (IIS) n Define which HttpHandler implementation you would like ASP.NET to use to handle requests for that file type To map the file type to ASP.NET, you select Control Panel, Administrative... the sign-in page with SSL Once the user has signed in, the encryption provided by ASP.NET by default will protect the user’s subsequent requests Of course, if you include a sign-in control on several pages, you will need to protect all those pages Building a Reusable Sign-in Control The standard way to do sign-in in ASP.NET applications that use forms authentication is to provide a sign-in Web form... control earlier in this chapter, in the section “Building a Reusable Sign-in Control.” Protecting Non -ASP.NET Content If you now use this control wherever you want an internal hyperlink in the application, the authentication ticket parameter will be added to the query string of the link Protecting Non -ASP.NET Content You usually use forms authentication to control access to a Web application itself—mainly... Passwords 508 Persistent Authentication Cookies 514 Using Forms Authentication in Web Farms 516 Cookieless Forms Authentication 519 Using forms authentication is a great way Protecting Non -ASP.NET Content 523 to create ASP.NET applications that require users to sign in to perform certain operations The features provided by forms authentication make it quick and easy to create a secure authentication system... controls that are in this user control This is why the CausesValidation property of the SignInButton control was set to False: You are calling the Validate methods of the validators rather than having ASP.NET do it automatically when the LinkButton controls are clicked You call the Validate methods of the validators because you do not want the sign-in control to be affected by the validation states... from signing the user in, even if the username and password TextBox controls were valid This is a problem for any user control that you want to operate independently of other parts of the page because ASP.NET groups all validators into a single collection under the Page object You could explicitly call the Validate methods on the two validators, but we thought it would be worth showing some general... following is the button click event from the code-behind file for a simple Web form that has a text box, a button, and two labels on it to accept a password and generate hashes in the two formats that ASP.NET can use: Private Sub GenerateHashes_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) _ Handles GenerateHashes.Click MD5Label.Text = “MD5: “ + _ FormsAuthentication.HashPasswordForStoringInConfigFile... body.Append(“&Date=”) body.Append(dateTimeTicks) body.Append(“&Check=”) body.Append(hash) email.Body = body.ToString Persistent Authentication Cookies By default, each user will be able to continue to use an ASP.NET application that is configured with the default forms authentication settings after logging in until one of two things occurs: The user does not make a request for a period of time set by the timeout... ensure that the elements of the servers’ configurations match Second, you need to ensure that all the servers use the same keys for encrypting and validating authentication tickets By default, ASP.NET auto-generates these keys at random, which obviously does not lead to the servers in a Web farm having matching keys You therefore need to explicitly set the values You do this through the ... clients might not be set up to support cookies Users whose client does not accept cookies will not be able to sign in to an application that relies on cookies to persist the authentication ticket The ASP.NET development team realized that this could be a problem and built the forms authentication system so that it is not limited to using cookies If a cookie with the correct name is not found, the forms . C:WINDOWSMicrosoft .NET Frameworkv1 .1. 4322>aspnet_regiis -lk W3SVC/ 1. 1.4322.0 W3SVC /1/ ROOT/ 1. 1.4322.0 W3SVC /1/ ROOT/MSMQ/ 1. 1.4322.0 W3SVC /1/ ROOT/Printers/ 1. 1.4322.0 W3SVC /1/ ROOT/ASPNETInsiders/. section): C:WINDOWS v1.0.3705>aspnet_regiis -s W3SVC /1/ ROOT/ASPNETInsiders Start installing ASP. NET DLL (1. 0.3705.0) ➥ recursively at W3SVC /1/ ROOT/ASPNETInsiders Finished

Ngày đăng: 21/01/2014, 09:20

TỪ KHÓA LIÊN QUAN