Tutorials to .com

Tutorials to .com » Asp » Base » Advanced Programming ASP 3.0 (29)

Advanced Programming ASP 3.0 (29)

Print View , by: iSee ,Total views: 8 ,Word Count: 1310 ,Date: Sat, 25 Apr 2009 Time: 7:18 PM

6.3.2 SA-FileUP components
In many Web site, a regular requirement is that the server to accept the client's ability to send documents how? In IIS 4.0 years, Microsoft provides a component called the Posting Acceptor to complete this work, IIS 5.0 and asp 3.0 is not the standard installation of the components, if the installation of Site Server Express, then the need to include this component. From the Microsoft Web site to download the component http://www.microsoft.com/windows/software/webpost/post_accept.htm.
However, many people have found in the Posting Acceptor component functions and limitations of programming it is very difficult. Now a popular alternative to the software Artisans from the SA-FileUP components. Components with the Posting Acceptor (only Type ISAPI filters) different, SA-FileUP components is a real ActiveX DLL server component, easily integrated into ASP page. This means that you can use ASP pages or other components used on the same page of the security settings and restrictions on user access to technology. The component is also available on the MTS / COM + environment to run.
The use of SA-FileUP course components can be found on http://www.activeserverpages.com/upload/ site, so here only the results are given. Examples of this chapter contains examples of the use of the components page (Chapter06 directory in a subdirectory SAFileUP), can be used to learn how to use the component, it is necessary if the Software Artisans Web site from http://www.softartisans. com / download copies of the SA-FileUP.
The use of SA-FileUP components
SA-FileUP sample page components to create a simple page contains a FileUpload element and a button, and use the HTML of the INPUT element, as shown in Figure 6-28:

Figure 6-28 the use of SA-FileUp sample page components
<FORM ACTION = "safileup_response.asp"
ENCTYPE = "MULTIPART / FORM-DATA" METHOD = "POST">
...
<INPUT TYPE="FILE" NAME="FILE1">
...
<INPUT TYPE="SUBMIT" NAME="SUB1" VALUE="Upload File">
...
</ FORM>
When users submit the form, in which the content sent to the server, and ASP pages to create a component instance, and began to upload information to the server, after a series of components to return the document describes the upload data, Figure 6 -- 29 follows:

Figure 6-29 the use of components of the SA-FileUP results
SA-FileUP components read from the file and put it in standard disk files or binary data in the form of a temporary database on the server. With it, you can use ASP to control the upload process, limiting the size of upload files, and even upload files to delete, but also dynamically change its file name and location.

Registry Access Components 6.3.3 RegEx
Microsoft IIS 4.0 provides an example of the server components be able to access the system registry. This feature will help to check such as installed software version, or check the IIS and the use of various parameters of the operating system.
In IIS 5.0 to remove the components, but if you need this feature can be obtained other commercial versions. RegEx component is one of the local machine to access any part of the registry (if allowed to access the current user). ASP page in the anonymous access, the current user account is IUSR_machinename.
1. RegEx component members
RegEx component provides four ways to read and write registry and a visit to the internal component version information methods, such as shown in Table 6-11. All information and documentation provided with the RegEx component, the test version can be downloaded from the http://www.stonebroom.com/. Examples of incidental page book included in the example provided, but you need to download the component itself.
Table 6-11 RegEx methods and components that
Methods
Description

GetRegValue (RegistryHive, SubKeyString)
Return from the registry subkeys to set the default value, if its value can not visit, then return an empty string

SetRegValue (RegistryHive, SubKeyString,
NewValue)
In a given sub-key, create or update the "default" value, the data type set to Reg_SZ (string). If the update is successful, return True; Otherwise, return False

GetRegValueEx (RegistryHive, SubKeyString,
ValueMane, ValueType)
From a particular sub-key named in the return value, use the return value data types, update the last method specified by the variable parameters. If the value can not visit, then return an empty string, and data types as REG_ERROR

SetRegValueEx (RegistryHive, SubKeyString,
ValueName, NewValue, ValueType)
In a given sub-key, create or update named value, the data type is set to approach the last parameter specifies the type data_type. If the update is successful, return True; otherwise return False

GetInternalVersionNumber ()
Return to the internal version number of components, if it is a test version of the return value contains the information

2. Components using RegEx
RegEx component provides a use of Visual Basic procedures for the preparation of the sample can be used to test which includes the methods, examples of procedures for the use of RegEx component, allowing the system to any part of the registry data types supported by one or by default string data type to read and write data, as shown in Figure 6-30. Before carrying out any updates will display a warning to prevent accidental operation.

Figure 6-30 Example use RegEx component procedures
There is also a relatively simple example of ASP, Web server to display some of the registry data, and allow time and set up a "test" sub-key. Can modify this page in your own applications to use when there is no restriction. Figure 6-31 is shown in NT4 and IIS 4.0 running on the outcome.

Figure 6-31 Component RegEx use the results of another sample
To remember to change the registry may lead to the numerical system does not normally work, the content of this before editing the registry should be backed up registry files.

6.4 Summary
This chapter discusses how to use ASP server component can not add other components to provide the features, but also takes into account server components and other types of ASP objects (such as the ASP built-in objects and in the script run-time library of the object) the difference between .
In the study was conducted by the ASP 3.0 and IIS 5.0 provide the following components can be installed on the three functions required to provide conventional commercial components, but also presents a number of downloads from the Web on the common components, some of them or is free to share / test version. However, so far we still have a very important component is not involved, it is the ADO. Before discussing this issue, first to discuss another fundamental problem: the error handling and debugging.


Asp Base Articles


Can't Find What You're Looking For?


Rating: Not yet rated

Comments

No comments posted.