Wrox Programmer Forums
|
Classic ASP Professional For advanced coder questions in ASP 3. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 18th, 2008, 06:17 AM
Registered User
 
Join Date: Apr 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Error giving when i create the Subdomain

I want to create Subdomain for example myname.domainname.com in asp i used the bellow code but this give me an error in local and server.
<%' User Data
strMySiteName=myname
'Server Name where the site is Running
strServer="192.168.0.10"
strRoot="c:\inetpub\wwwroot\store\"
strDomain=".mydomainname.com"


' Create Users Folder
Set sFile = CreateObject("Scripting.FileSystemObject")
If sFile.FolderExists(strRoot&strMySiteName) Then
Response.Write "User Allready Exists"
Response.End()
else

' Make connections to WMI, to the IIS namespace on server, and to the Web service.
' Setup Connections To IIS
set locatorObj = CreateObject("WbemScripting.SWbemLocator")
set providerObj = locatorObj.ConnectServer(strServer,"root/MicrosoftIISv2")
'set providerObj = locatorObj.ConnectServer(strServer, "root/MicrosoftIISv2", strUser, strPassword)
set serviceObj = providerObj.Get("IIsWebService='W3SVC'")

' Set Site Data
Bindings = Array(0)
Set Bindings(0) = providerObj.get("ServerBinding").SpawnInstance_()
Bindings(0).IP = ""
Bindings(0).Port = "80"
Bindings(0).Hostname = strMySiteName&strDomain

Set Bindings(1) = providerObj.get("ServerBinding").SpawnInstance_()
Bindings(1).IP = ""
Bindings(1).Port = "80"
Bindings(1).Hostname = "www"&strMySiteName&strDomain

'Create & Start Site
strSiteObjPath = serviceObj.CreateNewSite(strMySiteName, Bindings, strRoot&strMySiteName)

Set objPath = CreateObject("WbemScripting.SWbemObjectPath")
objPath.Path = strSiteObjPath
strSitePath = objPath.Keys.Item("")
Set serverObj = providerObj.Get(strSiteObjPath)
serverObj.Start

Set cfolder = sFile.CreateFolder(strRoot&strMySiteName)
'set getF=sFile.GetFolder(strSourcePath)
'getF.Copy(strRoot&strMySiteName)
'set getF=nothing
End if
set sfile=nothing
%>

Error Message is

SWbemLocator error '80041003'

Access denied

Can anybody help me.
Thanks







Similar Threads
Thread Thread Starter Forum Replies Last Post
create subdomain keyvanjan Classic ASP Professional 13 April 21st, 2008 12:46 AM
mysql_num_rows() => Giving Error? Cybot MySQL 4 September 12th, 2006 12:07 PM
This piece of code is giving an error sourik C# 2 July 15th, 2006 09:18 AM
This piece of code is giving an error sourik Classic ASP Databases 1 July 14th, 2006 09:10 PM
create subdomain keyvanjan ASP.NET 1.0 and 1.1 Professional 8 February 20th, 2006 05:44 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.