ASP script Components Implement server reboot _ application techniques

Source: Internet
Author: User

We know that the direct use of ASP is not enough to restart the server, then we need to make a component to implement the function, ASP through this component calls the system API, and then according to different restart and shutdown mode to operate!
The following first said the production of COM, in VB, a new project, of course, is Aceivex DLL.

1) First modify the engineering properties, in the Project Properties window to change the project name to system, in the class Module window to change the module name to Contral, save the project;

2 then add a module that declares the APIs and constants that need to be used, and the following are the contents of the module.
Declare Function exitwindowsex Lib "user32" (ByVal uflags as Long, ByVal dwreserved as long) as long

3 Enter the following code in the class module:

Public Function reboot (Atype as Variant)

t& = ExitWindowsEx (1, atype) end

Function

This function needs to pass in a parameter, used to control the startup mode, this parameter is passed from the ASP program, wait a moment to see the concrete use Method!
Write the above code, save the project, compile the project into System.dll. The following is written in ASP program:
The code in ASP is very simple:

<%
atype=request ("Atype")
set Sys=server. CreateObject ("System.contral")
sys.reboot (atype)
%>

Where atype can use 0, 1, 2, 4,0, 1 and 4 are all shut down , 2 used to restart, after writing ASP can be executed.

The above is the production of an ASP script components to enable the server to restart the implementation of the method, I hope to help you learn.

Related Article

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.