Making ASP script components to implement reboot server

Source: Internet
Author: User
Tags implement

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 and then add a module that declares the APIs and constants that need to be used! Here 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 to write 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 to shut down, and 2 to reboot. After the completion of the implementation of ASP can be!

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.