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
|