ASP Connection Execution Program

Source: Internet
Author: User
Program | Execution one, requirements
Currently, using ASP to develop dynamic Web pages, clients using Microsoft's IE Series Browser view is a very popular mode. We encountered this problem during the development process, because of the technical and time constraints, we must call an execution program in the Web page. You can, of course, use a hyperlink to directly point to the program you want, but doing so would be "black" for Microsoft: each time you open the link in IE, an unwelcome warning box (of course, it has its reasons, mainly for security reasons), is acceptable to users. Can you solve this problem in a very convenient and concise way?
After a study, the introduction of a so-called "Lidaitaojiang" method:
L Create a specific file type in the system, such as: *.spa;
2 Associate the type of file with the program to be executed in ASP;
The 3 hyperlink points to a file with a set extension of "spa."
The rationale for this approach is: When you open a file through a hyperlink in IE, if the browser itself can interpret the type of file, the contents of the file are displayed directly in the browser, such as a text file, or you search the registry settings, find the program that handles this type of file, and then call the appropriate program to open the file.
Second, the method
The implementation method is manual and automatic, as follows:
(i), manual setup
Open Explorer, as shown in Figure 1, by clicking the Folder Options menu in the [View] menu, the system displays the Folder Options dialog, as shown in Figure 2, which has a file type page;

Note: You must select a file or folder, if you select the [printer] or [Control Panel], and so on this dialog box does not have this page

2 Click [New Type (N) ...] button, open the [Add New File Type dialog box, as shown in Figure 3. Enter ASP Association in the type description text box and enter ". Spa" in the related extension text box; (Note: [Content type] is used to select a type of file associated with a program that you have installed, which is not filled in)

3 Open ", click [Browse (R) ...] button, in the dialog box, select the program you want to call in ASP.

4 click on the [OK] button of each dialog box to complete;

Special Note: The next aspect of the Add New File Type dialog box, shown in Figure 3, has a [Confirm open after download] option. This option is selected by default, in which case when the. Spa type of file is first opened in a Web page, a prompt box is asked whether to always open the type of file with a program. If this box does not want to go out, you must leave the [Confirm open after download] option unchecked

When the settings are complete, the hyperlink points to a file, such as A.spa, and then click Once, and you will see that the program you need is running without any conditions!
Automatically set
Obviously, when the system is delivered to the user, if it is unrealistic to require the user to do the above, the viability of the software will be greatly compromised, as few people will be willing to listen to the extension and the registry. Then you must let the work of the statement be done automatically.
After a manually-set program is associated with a file, all relevant information is present in the registry, so the ability to associate executable programs can be achieved by simply writing the same content in the registry. Writing some information in the registry is a relatively simple thing for existing programming software, such as VB and Delphi provide a complete access to the contents of the registry functions, and packaging tools are usually provided to write the registry function. So how to find the corresponding information in the registry. The method should be as follows:
L Open Registry Editor (click on the Start menu to run, enter "regedit" in the File box, return);
2 Click the Find menu item in the Edit menu in Registry Editor, in the Find Target text box, enter. Spa, and then start looking, and soon you'll find a primary key called ". Spa," which has a default string value of "Spafile." Click on the [Registry] menu [export Registry File] to export the primary key settings to a file, such as "Spa1.reg";
4 Use the Find menu item again on the Edit menu, enter "Spafile" in the Find target text box, and then start looking, and soon you'll find a primary key called "Spafile", which has the same subkey as "Shell", using the same method as the previous step, Export the settings of the primary key to a file, such as "Spa2.reg"
Now just open these two files, refer to the settings to write a few lines of program, the work is done!

3. Contents of two registry files
L Spa1.reg
[Hkey_classes_root\.spa]
@= "Spafile"
Note: "@" is the default meaning

L Spa2.reg
[Hkey_classes_root\spafile]
@= "ASP Association"
"EditFlags" =hex:00,00,01,00

[Hkey_classes_root\spafile\shell]
@=""

[Hkey_classes_root\spafile\shell\open]
"EditFlags" =hex:01,00,00,00

[Hkey_classes_root\spafile\shell\open\command]
@= "C:\\windows\\notepad.exe%1"



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.