473,480 Members | 4,939 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Cannot create a Virtual Directory using System.DirectoryServices on Windows Vista RC1

The following is an extract from a C# console application that creates
a Virtual Directory on IIS 5 or 6.

This code works on XP, Windows 2003 Server, Windows 2000.

It does not work on Windows Vista Release Candidate 1 (IIS 7).

The below line

pcProps[VDPROP_PATH].Value = strPath;

throws the exception "Path not found".

Note that the user running the exe has administrator rights on the
machine.

Also, this may be a related issue:

The Microsoft VB script C:\Inetpub\Adminscripts\mkwebdir.vbs no longer
works on Windows Vista RC1 when logged in as an administrator. The
exact same script and parameters runs on Windows XP.

Interestingly, I have found that other sample code downloaded from the
Internet that creates virtual directories does not work on Vista
either.

I suspect that this is a rights issue, but I do not know how to solve
this.

Thanks for your help.

+++++++++++

Code extract:
DirectoryEntry deRoot = new DirectoryEntry(IIS_DIR);

if (null != deRoot)

try
{
// check to see if this Virtual Directory already exists
m_deVirtualDir = deRoot.Children.Add(m_strVirtualDir,
IIS_SCHEMA_VIRTUAL_DIR);
}
catch
{
try
{
String strDir = IIS_DIR + "/" + m_strVirtualDir;
m_deVirtualDir = new DirectoryEntry(IIS_DIR + "/" +
m_strVirtualDir);
}
catch
{
}
}

if (null != m_deVirtualDir)
{
// commit the changes so far!
deRoot.CommitChanges();
m_deVirtualDir.CommitChanges();

// now we need to set up some properties of the new virtual
// directory
PropertyCollection pcProps = m_deVirtualDir.Properties;
// set the Path to the Virtual Directory
string strPath = m_strIISPath + "\\" + m_strVirtualDir;

// exception generated here
pcProps[VDPROP_PATH].Value = strPath;

etc etc

Oct 5 '06 #1
1 3047
Please post Vista related problems to the Vista forums, check following URL
for available NG's and Forums
http://msdn.microsoft.com/windowsvis...y/default.aspx.
Be aware that on Vista, even an administrator runs with reduced privileges
(by default), I suggest you try to strat this with elevated privileges.

Willy.
<fr********@hotmail.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...
| The following is an extract from a C# console application that creates
| a Virtual Directory on IIS 5 or 6.
|
| This code works on XP, Windows 2003 Server, Windows 2000.
|
| It does not work on Windows Vista Release Candidate 1 (IIS 7).
|
| The below line
|
| pcProps[VDPROP_PATH].Value = strPath;
|
| throws the exception "Path not found".
|
| Note that the user running the exe has administrator rights on the
| machine.
|
| Also, this may be a related issue:
|
| The Microsoft VB script C:\Inetpub\Adminscripts\mkwebdir.vbs no longer
| works on Windows Vista RC1 when logged in as an administrator. The
| exact same script and parameters runs on Windows XP.
|
| Interestingly, I have found that other sample code downloaded from the
| Internet that creates virtual directories does not work on Vista
| either.
|
| I suspect that this is a rights issue, but I do not know how to solve
| this.
|
| Thanks for your help.
|
| +++++++++++
|
| Code extract:
| DirectoryEntry deRoot = new DirectoryEntry(IIS_DIR);
|
| if (null != deRoot)
|
| try
| {
| // check to see if this Virtual Directory already exists
| m_deVirtualDir = deRoot.Children.Add(m_strVirtualDir,
| IIS_SCHEMA_VIRTUAL_DIR);
| }
| catch
| {
| try
| {
| String strDir = IIS_DIR + "/" + m_strVirtualDir;
| m_deVirtualDir = new DirectoryEntry(IIS_DIR + "/" +
| m_strVirtualDir);
| }
| catch
| {
| }
| }
|
| if (null != m_deVirtualDir)
| {
| // commit the changes so far!
| deRoot.CommitChanges();
| m_deVirtualDir.CommitChanges();
|
| // now we need to set up some properties of the new virtual
| // directory
| PropertyCollection pcProps = m_deVirtualDir.Properties;
|
|
| // set the Path to the Virtual Directory
| string strPath = m_strIISPath + "\\" + m_strVirtualDir;
|
| // exception generated here
| pcProps[VDPROP_PATH].Value = strPath;
|
| etc etc
|
Oct 5 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
4730
by: Andrew | last post by:
Hey all, Working on revamping our Intranet here and making use of the LDPA, Active Directory, Directory Services, etc. that .Net provides. I am still fairly new on this subject, so the problem...
4
2446
by: Stephen Cochran | last post by:
I'm getting the following error in my ASP.NET application: Namespace or type 'DirectoryServices' for the Imports 'System.DirectoryServices' cannot be found. I have added the...
1
3640
by: Stephane | last post by:
Hi, I'm trying to create a virtual directory dynamically in my web site using ASP.NET. I received this error: System.Runtime.InteropServices.COMException (0x800700B7): Cannot create a file...
9
3160
by: Patrick | last post by:
I have an ASP.NET page that searches for someone in the corporate Active Directory. It had been working fine until recently when I changed from Basic Authentication on IIS6 back to Integrated...
2
2263
by: BobAchgill | last post by:
I also asked this in the inetserver.iis.ftp forum... I would like some example VB .NET code that shows how to add a new FTP site in IIS and virtual directory with System.DirectoryServices. It...
4
1835
by: Just D. | last post by:
How can we change the property of one subdirectory of the Virtual Directory? One of the directories should be granted "Write". Should we delete this Virtual Directory to recreate it with the...
18
23748
by: Arthur | last post by:
Hi All, I would like to get the name of the user given their networkID, is this something Active Directory would be useful for?(For intranet users) If so, can you please point me to some sample...
2
3179
by: zimmys | last post by:
hello, i want to create a new active directory schema property. for testing, i use the following simpy function: public void createProperty() { string cn = "leo8";
1
2248
by: zion | last post by:
Hello, How can I programaticly create IIS virtual directory on Vista? Thanks
0
7040
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6905
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7080
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
6908
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5331
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4478
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
2980
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
561
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
178
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.