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
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,
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
------=_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> </DIV>
<DIV><FONT face=3DVerdana size=3D2>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.</FONT></DIV>
<DIV><FONT face=3DVerdana size=3D2></FONT> </DIV>
<DIV><FONT face=3DVerdana size=3D2>here is the code to create virtual
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
as string =3D "myWeb"<BR>vRoot =3D =
GetObject("IIS://LocalHost/W3svc/1/Root") '<-
"sometimes exception here"<BR>Dim vdir =3D =
vRoot.Create("IIsWebVirtualDir", webDir
) '<- "sometimes exception here"<BR>vdir.Path =3D somepath + =
webFolder ' this
is a valid path provided <BR>vdir.DefaultDoc =3D =
"default.aspx"<BR>vdir.AccessSSL
=3D
True<BR>vdir.SetInfo()<BR>vdir.AppCreate(True)<BR></FONT></P></FONT></FON=
T><FONT
size=3D2></FONT></FONT></FONT></DIV>
<DIV><FONT face=3DVerdana><FONT size=3D2>Can some body help me with =
this.
</FONT><FONT size=3D2>I am getting random errors in this code, when I =
provide the
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..."
</FONT></DIV>
<DIV><FONT face=3DVerdana size=3D2>2. "Cannot create a file when that =
file already
exists(Exception from HRESULT:0x800700B7)"</FONT></DIV>
<DIV><FONT face=3DVerdana size=3D2></FONT> </DIV>
<DIV><FONT face=3DVerdana size=3D2>at statement: </FONT><FONT =
size=3D2><FONT
face=3DVerdana size=3D2>vRoot.Create("IIsWebVirtualDir",
websiteVirtualDir)</FONT></FONT></DIV>
<DIV><FONT face=3DVerdana size=3D2></FONT> </DIV>
<DIV><FONT face=3DVerdana size=3D2>Is there something I am missing =
here, Any
help will be appreciated. </FONT></DIV>
<DIV><FONT face=3DVerdana size=3D2></FONT> </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> </DIV>
<DIV><FONT face=3DVerdana size=3D2></FONT> </DIV></BODY></HTML>
------=_NextPart_000_0026_01C898E5.83BA5A60--
