Use ASP to start/stop specifying Web sites _ Application Tips

Source: Internet
Author: User
Tags error code
=============================================================
' Thank you for using the utility function program developed by the ASP001 studio
' HTTP://WWW.ASP001.NET
' ============================================================= ' ASP001 studio to provide you with custom program development, corporate Internet Outreach services
' qq:1974229
' E-mail:shenyangchuqi@tom.com
' More programs download please go to HTTP://WWW.ASP001.NET
'=============================================================
' Function Description: Use ASP to start/stop the specified Web site
' This function uses ADSI and requires Administrators group user rights
' Function name: Adminwebsite (computer,websitenum,dowhat)
' Program development: ASP001 Studio Chuqi
' Usage: adminwebsite (computer name, site number, start/stop)
' Example: Start a site with a site number of 1 on the 127.0.0.1 computer
' Adminwebsite ' 127.0.0.1 ', ' 1 ', 1
' Example: Stop 127.0.0.1 a site with a site number of 1 on the computer
' Adminwebsite ' 127.0.0.1 ', ' 1 ', 0
'=============================================================



Function Adminwebsite (Computer,websitenum,dowhat)
On Error Resume Next
Set objserver = GetObject ("iis://" & Computer & "/w3svc/" & Websitenum)
If err.number <> 0 Then
Response.Write Now & ". Error code: "& Hex (ERR) &"-"&" could not open the specified site <br> "
End If
If Dowhat=1 Then
' Start the site with start
Objserver.start
If err.number <> 0 Then
Response.Write "Cannot start the specified Web site <br>"
Else
Response.Write "has started the specified Web site <br>"
End If
ElseIf Dowhat=0 Then
' Stop site with stop
Objserver.stop
If err.number <> 0 Then
Response.Write "Cannot stop specifying Web site <br>"
Else
Response.Write "has stopped specifying Web sites <br>"
End If
End If
End Function
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.