Bookmarks

Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

sqlexpress database file auto-creation error, dbf2mysql parameter, WWWXXXAPC, wwwxxxAPC, How to unsubscrube from dategen spam, docmd.close 2585, WWWXXXDOCO, nu vot, dhcpd lease file "binding state", WWWXXXDOCO

Links

XODOX
Impressum

#1: Problem while creating virtual directory programatically.

Posted on 2008-04-07 15:58:10 by Balaram Barange

This is a multi-part message in MIME format.

------=_NextPart_000_0026_01C898E5.83BA5A60
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi All,

I am trying to create a virtual directory programatically using the =
following code, if works fine, but when I try to create with the same =
name again, I get exception. If I use diffrent names for virtual =
directory no issues, and I am actually deleting that virtual directory =
before creating it again.

here is the code to create virtual directory:
Dim webDir as string =3D "myWeb"
vRoot =3D GetObject("IIS://LocalHost/W3svc/1/Root") '<- "sometimes =
exception here"
Dim vdir =3D vRoot.Create("IIsWebVirtualDir", webDir ) '<- "sometimes =
exception here"
vdir.Path =3D somepath + webFolder ' this is a valid path provided=20
vdir.DefaultDoc =3D "default.aspx"
vdir.AccessSSL =3D True
vdir.SetInfo()
vdir.AppCreate(True)


Can some body help me with this. I am getting random errors in this =
code, when I provide the same virtual directory name,=20
sometimes it gives
1. "Object reference not set to instance of..."=20
2. "Cannot create a file when that file already exists(Exception from =
HRESULT:0x800700B7)"

at statement: vRoot.Create("IIsWebVirtualDir", websiteVirtualDir)

Is there something I am missing here, Any help will be appreciated.=20

Thanks,
Bala


------=_NextPart_000_0026_01C898E5.83BA5A60
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.6000.16608" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DVerdana size=3D2>Hi All,</FONT></DIV>
<DIV><FONT face=3DVerdana size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DVerdana size=3D2>I am trying to create a &nbsp;virtual =
directory=20
programatically using the following code, if works fine, but when I try =
to=20
create with the same name again, I get exception. If&nbsp;I use diffrent =
names=20
for virtual directory no issues,&nbsp;and I am actually deleting that =
virtual=20
directory before creating it again.</FONT></DIV>
<DIV><FONT face=3DVerdana size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DVerdana size=3D2>here is the code to create virtual=20
directory:</FONT></DIV>
<DIV><FONT size=3D1><FONT size=3D1><FONT color=3D#0000ff size=3D2>
<P><FONT color=3D#000000></FONT><FONT color=3D#000000><FONT =
face=3DVerdana>Dim webDir=20
as string =3D "myWeb"<BR>vRoot =3D =
GetObject("IIS://LocalHost/W3svc/1/Root") '&lt;-=20
"sometimes exception here"<BR>Dim vdir =3D =
vRoot.Create("IIsWebVirtualDir", webDir=20
) '&lt;- "sometimes exception here"<BR>vdir.Path =3D somepath + =
webFolder ' this=20
is a valid path provided <BR>vdir.DefaultDoc =3D =
"default.aspx"<BR>vdir.AccessSSL=20
=
True<BR>vdir.SetInfo()<BR>vdir.AppCreate(True)<BR></FONT></P></FONT></FON=
T><FONT=20
size=3D2></FONT></FONT></FONT></DIV>
<DIV><FONT face=3DVerdana><FONT size=3D2>Can some body help me with =
this.=20
</FONT><FONT size=3D2>I am getting random errors in this code, when I =
provide the=20
same virtual directory name, </FONT></FONT></DIV>
<DIV><FONT face=3DVerdana size=3D2>sometimes it gives</FONT></DIV>
<DIV><FONT face=3DVerdana size=3D2>1. "Object reference not set to =
instance of..."=20
</FONT></DIV>
<DIV><FONT face=3DVerdana size=3D2>2. "Cannot create a file when that =
file already=20
exists(Exception from HRESULT:0x800700B7)"</FONT></DIV>
<DIV><FONT face=3DVerdana size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DVerdana size=3D2>at statement: </FONT><FONT =
size=3D2><FONT=20
face=3DVerdana size=3D2>vRoot.Create("IIsWebVirtualDir",=20
websiteVirtualDir)</FONT></FONT></DIV>
<DIV><FONT face=3DVerdana size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DVerdana size=3D2>Is there something I am&nbsp;missing =
here, Any=20
help will be appreciated. </FONT></DIV>
<DIV><FONT face=3DVerdana size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DVerdana size=3D2>Thanks,</FONT></DIV>
<DIV><FONT face=3DVerdana size=3D2>Bala</FONT></DIV>
<DIV><FONT face=3DVerdana size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DVerdana size=3D2></FONT>&nbsp;</DIV></BODY></HTML>

------=_NextPart_000_0026_01C898E5.83BA5A60--

Report this message

#2: RE: Problem while creating virtual directory programatically.

Posted on 2008-04-12 03:11:00 by Engtmk

hi bala,

you can search for file named "iisvdir.vbs" which is script written by
microsoft to enble admins to query/create/delete virtual dir

you can also use it very easily to create the virtual directory easilly.

"Bala" wrote:

> Hi All,
>
> I am trying to create a virtual directory programatically using the following code, if works fine, but when I try to create with the same name again, I get exception. If I use diffrent names for virtual directory no issues, and I am actually deleting that virtual directory before creating it again.
>
> here is the code to create virtual directory:
> Dim webDir as string = "myWeb"
> vRoot = GetObject("IIS://LocalHost/W3svc/1/Root") '<- "sometimes exception here"
> Dim vdir = vRoot.Create("IIsWebVirtualDir", webDir ) '<- "sometimes exception here"
> vdir.Path = somepath + webFolder ' this is a valid path provided
> vdir.DefaultDoc = "default.aspx"
> vdir.AccessSSL = True
> vdir.SetInfo()
> vdir.AppCreate(True)
>
>
> Can some body help me with this. I am getting random errors in this code, when I provide the same virtual directory name,
> sometimes it gives
> 1. "Object reference not set to instance of..."
> 2. "Cannot create a file when that file already exists(Exception from HRESULT:0x800700B7)"
>
> at statement: vRoot.Create("IIsWebVirtualDir", websiteVirtualDir)
>
> Is there something I am missing here, Any help will be appreciated.
>
> Thanks,
> Bala
>
>

Report this message

#3: RE: Problem while creating virtual directory programatically.

Posted on 2008-04-12 03:11:00 by Engtmk

hi bala,

you can search for file named "iisvdir.vbs" which is script written by
microsoft to enble admins to query/create/delete virtual dir

you can also use it very easily to create the virtual directory easilly.

"Bala" wrote:

> Hi All,
>
> I am trying to create a virtual directory programatically using the following code, if works fine, but when I try to create with the same name again, I get exception. If I use diffrent names for virtual directory no issues, and I am actually deleting that virtual directory before creating it again.
>
> here is the code to create virtual directory:
> Dim webDir as string = "myWeb"
> vRoot = GetObject("IIS://LocalHost/W3svc/1/Root") '<- "sometimes exception here"
> Dim vdir = vRoot.Create("IIsWebVirtualDir", webDir ) '<- "sometimes exception here"
> vdir.Path = somepath + webFolder ' this is a valid path provided
> vdir.DefaultDoc = "default.aspx"
> vdir.AccessSSL = True
> vdir.SetInfo()
> vdir.AppCreate(True)
>
>
> Can some body help me with this. I am getting random errors in this code, when I provide the same virtual directory name,
> sometimes it gives
> 1. "Object reference not set to instance of..."
> 2. "Cannot create a file when that file already exists(Exception from HRESULT:0x800700B7)"
>
> at statement: vRoot.Create("IIsWebVirtualDir", websiteVirtualDir)
>
> Is there something I am missing here, Any help will be appreciated.
>
> Thanks,
> Bala
>
>

Report this message